20130517

autoreply.pl Conundrum


A while ago, I posted a question in the Linux Section of MyBroadband about email autoreplies (as set in /etc/aliases) using the autoreply.pl script (which I believe comes with Webmin?).

Anyhow, the issue was that if one user had an autoreply set on their email, and they were included via CC or BCC in an email to one or more other users, the auto reply would respond to the original sender listing the "From" header as the address of the user the original email (the email to which the auto reply is now replying) listed first in the "To" header. I could probably word that better, but I'm not going to. Obviously, this causes issues as if steve@foo.bar sends an email to jim@foo.bar CC'ing fred@foo.bar, and Fred has an auto reply set up, then Steve will get Fred's autoreply, only it will seem like it was sent from Jim, thus leading Steve to believe Jim is away, drive over to Jim's house, sleep with Jim's wife, only to have Jim arrive home from work and bludgeon Steve to death with a SCSI cable. Needless to say, this is not something the more "vigilant" sysadmin would want (have you ever tried to clean blood off a SCSI cable?).

After some poking about, I realised that this autoreply nonsense would only happen if there were forward aliases set up in /etc/aliases. i.e. if "fred@foo.bar" was forwarding to "fred.fredson@foo.bar", etc. That way, if an email was sent to fred@foo.bar, it would then be forwarded to the actual mailbox of fred.fredson@foo.bar which would then send an autoreply, the headers of which would get lost as it was forwarded around. There is a pretty easy way around this, all you have to do is add a line to the top of each user's autoreply file (the file referenced by autoreply.pl where you would write the actual reply to be sent):

From: user@foo.bar


Obviously, you would replace "user@foo.bar" with the user's email address. This would ensure that when the autoreply is sent, the From header remains unchanged, regardless of how many times it is forwarded, aliased, marked as spam, released from quarantine and ignored by the original sender.

I realise I am probably the only person to ever actually deal with this problem, but hell, maybe someone else out there may benefit from a link to this blog appearing in their Google search.

No comments:

Post a Comment