Prevent auto reply to alias forwarded messages

Auto reply is not always a good idea when the message was sent to an alias address and forwarded to some mailbox. For instance, one sends an email to dep@mycompany.com. It's not desirable that it receives a reply from guyinvacations@mycompany.com

I achieved that editing

/etc/webmin/virtual-server/autoreply.pl

and writing the folowing code:

79,87d78
< # v v algol 2012-08-01 v v #
< # If it's a forwared message
< if ( not ($header{'x-original-to'} eq $ARGV[1] ||
< $header{'x-original-to'} =~ /^([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name)))$/ && $1 eq $ARGV[1]) ) {
<    # Do nothing if not for me
<    print STDERR "Not autoreplying to forwarded message\n";
<    exit 0;
< }
< # ^ ^ algol ^ ^ #

But that file is rewritten every time virtualmin is restarted and maybe it would be a good feature to have a configuration option.

Status: 
Active

Comments

That seems a little risky to enable by default though - many users have forwarding setup from an alternate address, and would still want to send autoreplies.

Also, the autoreply script does correctly not reply when mail is relayed through a mailing list, like one managed using Mailman.