-
Notifications
You must be signed in to change notification settings - Fork 7
Detecting autoresponders
Detecting autoresponders – also known as "automatic vacation responders" or "out of office auto-replies" – is tricky. RFC 3834 defines the Auto-Submitted
header field, which indicates that a message is an automatic response unless it is absent or its value is no
. IANA maintains a list of possible values for Auto-Submitted
. However, not all MTAs set Auto-Submitted
on autoresponses.
- Many MTAs set
Return-Path: <>
orReturn-Path: <MAILER-DAEMON>
, including Microsoft IIS' SMTP service (in most cases, this would signify a bounce) - BoxTrapper and CPanel set
Preference: auto_reply
,X-Precedence: auto_reply
, andX-Autorespond
-
Communicate Pro sets
X-Autogenerated
to one ofForward
,Group
,Letter
,Mirror
,Redirect
orReply
- Domain Technologie Control sets
X-AutoReply-From
andX-Mail-Autoreply
- FirstClass sets
X-FC-MachineGenerated: true
- GMail sets
Auto-Submitted: auto-replied
,Precedence: bulk
andX-Autoreply: yes
- Mailtraq sets
X-POST-MessageClass: 9; Autoresponder
- qmail sets
Delivered-To: Autoresponder
Some MTAs do not set any relevant headers, for example, some configurations of Microsoft Exchange Server. In such cases, it is necessary to inspect the subject line; for example, it is common for an autoresponse to begin with Out of Office AutoReply:
. It is unwise to attempt to detect autoresponses using regular expressions against the message body.
The example vacation program in RFC 3834 and this Exim wiki page provide sample scripts for detecting autoresponders. mySociety's alaveteli and commonlib projects have code for detecting autoresponses.
A fairly good regular expression to detect autoresponders by inspecting the subject line is:
/\AAuto Response\z|\AOut of Office(?:\z| Alert\z| AutoReply:| Reply\z)|\bis out of the office\.?\z/i
In some cases, the subject line tests used by Alaveteli and Exim are unnecessary, as the header rules described above are sufficient.