34

Been googling for this and haven't found anything ...

Does anybody know if there is a way, given an Outlook email item, to detect whether it was sent by the "Out Of Office Assistant"? Is there any property that Outlook sets on the object, or any header information, that identifies an email as such? I was hoping not to have to parse the subject line for "Out Of Office", etc.

It would be great if there were some standard, so autoreplies from other email services (like Gmail) could also be detected, but for me Outlook is the highest priority.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
jean
  • 1,027
  • 1
  • 8
  • 15
  • 1
    This is the best answer I've come across http://stackoverflow.com/questions/154718/precedence-header-in-email/301958#301958. If you're connecting to the same exchange server as the auto-reply person you might be able to use a property on the exchange item like this https://social.technet.microsoft.com/Forums/office/en-US/55835d56-5f80-4b70-8d61-18bd4f056180/how-to-identify-an-out-of-office-email-message?forum=exchangesvrdevelopment – Rory Feb 27 '16 at 00:30

7 Answers7

34

This question often comes up in Google, so I decided to add an important note.

Don't ever use X-Auto-Response-Suppress in your filters as suggested in the other answer.

X-Auto-Response-Suppress is used by Exchange to tell other servers to not send auto-replies in response to an email. It doesn't mean that this email is an auto-response.

We had to learn it the hard way, hope you won't have to. I've also wrote a blog post with more details: http://www.jitbit.com/maxblog/18-detecting-outlook-autoreplyout-of-office-emails-and-x-auto-response-suppress-header/

Max Al Farakh
  • 4,386
  • 4
  • 29
  • 56
  • Thanks - I added a note in my list. I did found this header in auto-replies too, but you're right, one has to be careful here. – Andris Jul 23 '15 at 12:20
  • I like this answer best, so to copy the info from your blog here to SO where it can be archived, the summary is Use `X-Autoreply`, `X-Autorespond`, and `auto-submitted: auto-replied` to detect the replies, and then add `X-Auto-Response-Suppress:OOF` to your own messages to request that the auto-responses not be sent in the first place. – M Conrad Aug 07 '16 at 02:36
  • 1
    YES!! For instance, Atlassian send their "validate your email" using the "X-Auto-Response-Suppress" header set to "All". Don't ask me why, but if you filter this, you will never get their emails... – Cyril N. Feb 07 '22 at 11:15
31

Look for these headers:

  • x-autorespond
  • precedence or x-precedence with value "auto_reply", "bulk" or "junk"
  • auto-submitted with value "auto-replied"
  • x-auto-response-suppress (not always, see answer below)

And subjects starting with:

  • Auto:
  • Automatic reply
  • Autosvar
  • Automatisk svar
  • Automatisch antwoord
  • Abwesenheitsnotiz
  • Risposta Non al computer
  • Automatisch antwoord
  • Auto Response
  • Respuesta automática
  • Fuori sede
  • Out of Office
  • Frånvaro
  • Réponse automatique
Andris
  • 4,392
  • 2
  • 20
  • 16
21

It's worth noting that Exchange is supposed to suppress out-of-office emails in response to messages with a Precedence:bulk or X-Auto-Response-Suppress:OOF header:

http://blogs.technet.com/b/exchange/archive/2006/10/06/3395024.aspx

seb
  • 3,646
  • 26
  • 21
  • Regarding newer Exchange: aside from `X-Auto-Response-Suppress:OOF` being incorrect, as others have explained (you use it to _request_ not getting an autoresponse in the first place, not to _declare_ your e-mail as an autoresponse), I find that I don't get `Precedence` headers at all. Rather, Exchange sets: `Auto-Submitted: auto-generated` (not auto-replied!) – Sören Kuklau Jun 12 '18 at 09:32
9

There is a header field (http://www.iana.org/assignments/auto-submitted-keywords/auto-submitted-keywords.xhtml) but it seems that MS Outlook does not set it (at least, not Outlook 2003). I guess that you have to parse the subject line.

  • 1
    That would be really great, but unfortunately it looks like the proposal is too recent (2008-12-23) for any Microsoft product. – jean Jun 22 '09 at 19:20
  • 1
    The Subject is terribly brittle; localized versions of Oulook have a localized Subject. But even if you'd be able to get a list of all the translations in every version of Outlook (and Exchange, etc) this is also prone to false positives. – tripleee Sep 06 '11 at 07:48
  • 3
    I've tested with Outlook 2010 and Exchange 2010 and the auto reply has "Auto-Submitted: auto-replied" attribute. – Razvan Stefanescu Jan 14 '14 at 10:03
  • 3
    Office 365 currently puts these interesting headers on `X-Auto-Response-Suppress: All`, `Auto-Submitted: auto-generated`, `X-MS-Exchange-Inbox-Rules-Loop: the-mailbox-primary-smtp-address` – Rory Feb 26 '16 at 23:49
  • 1
    But before you go racing to use `X-Auto-Response-Suppress` like I was going to ... https://www.jitbit.com/maxblog/18-detecting-outlook-autoreplyout-of-office-emails-and-x-auto-response-suppress-header/ – Rory Feb 27 '16 at 00:00
4

The question asks about detecting autoreply/out-of-office emails and a lot of the answers here refer to the X-Auto-Response header, which instructs Microsoft Exchange on how to deal with an incoming message with auto-responses. This is the wrong direction; keying on this header does not help detect an auto-response message. (Though theoretically auto-responses would use it in order to prevent an infinite exchange of auto-responses.)

There are lots of dead links in other answers. It appears Microsoft's documentation links don't last.

[MS-OXCMAIL]: RFC 2822 and MIME to Email Object Conversion Algorithm §2.1.3.2.20 Auto Response Suppress (archive link) appears to be the current definitive documentation for this header (even though RFC 2822 was obsoleted by RFC 5322 in 2008).

X-Auto-Response-Suppress header values:

Header Meaning
None (No meaning given, but this should be self-explanatory)
All (No meaning given, but this should be self-explanatory)
DR   Suppress delivery reports from transport.
NDR Suppress non-delivery reports from transport.
RN Suppress read notifications from receiving client.
NRN Suppress non-read notifications from receiving client.
OOF Suppress Out of Office (OOF) notifications.
AutoReply Suppress auto-reply messages other than OOF notifications.

Example header:

 X-Auto-Response-Suppress: RN, NRN

Order does not matter.

I personally find NDR rather odd since it is another name for a bounce, which typically does not observe message content (i.e. headers). That's SMTP-level (RFC 821/2821/5321) rather than .eml-level (RFC 822/2822/5322).

In a ~million-email sample, I observed the most common values of this header to be:

  1. All
  2. DR, OOF, AutoReply
  3. DR, RN, NRN, OOF, AutoReply
  4. OOF
  5. DR, RN, OOF, AutoReply
  6. OOF, AutoReply
Adam Katz
  • 14,455
  • 5
  • 68
  • 83
1

According to Exchange Server 2007 Out of Office (OOF)1 - Exchange Team Blog, the authoritative sign of an Exchange's Out-of-Office reply is

X-Auto-Response-Suppress:OOF

1"OOF" means "out of facility", a rudiment from Xenix(!) that M$ used for mail in the past.

ivan_pozdeev
  • 33,874
  • 19
  • 107
  • 152
1

I looked into header of Outlook auto reply emails but didn't find any special. You can try a little trick here - Just keep track of time at which your mail server sends out the mail to users. If the mail server receives a reply mail within few seconds (say less than 10 seconds), its probably an auto reply. Incorporate this with subject parsing to get better detection of auto reply mails. Its not a concrete method but I guess it will work.