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 It's not desirable that it receives a reply from

I achieved that editing


and writing the folowing code:

< # 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.



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.