These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Auto reply only to direct (not forwarded) messages on the new forum.
Hi,
My site have a general "contact" address that is forwarded to several users. One of these users has just set an auto reply rule on his own address as he's on holiday.
The problem is that when somebody send an email to "contact", he gets an auto reply from this user's address.
Is there a way to send an auto reply only when the message is directly sent to this user's address and not forwarded from "contact"?
I achieved that by editing
/etc/webmin/virtual-server/autoreply.pl
and writing the following 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 now and then. Didn't tried it yet but I think that it could be solved by copying it back to
/usr/share/webmin/sendmail/autoreply.pl
and/or
/usr/share/webmin/postfix/autoreply.pl