I've got a problem that I need to resolve that is as follows.
We have a staff mailserver, running exim3.x. Our domain in <domain>.net
Some of our less than skilled salespeople keep putting the .com suffix on
mails they send out and the guy with the catch all at <domain>.com is
rightly tired of receiving misdirected mails. Theres also the issue that he
receives confidential information, so I've been asked to set up the
following:-
Bounce mails back that are received to <domain>.com with a specified text
inserted in the reply, indicating that possibly it was a <domain>.net
domain part that they really wanted. Also stating that if they really want
to mail <domain>.com to use <domain>.com.really
Then rewrite <domain>.com.really to <domain>.com & send it.
Rewriting domain.com.really is straightforward.
However designing a method of capture/bounce & insert the required text has
been causing me some head scratching.
Heres an attempt using a router/transport, but the problem is the rewrote
address gets resubmitted to the whole router/director chain & gets caught
again.
<domain>_com:
driver = domainlist
transport = bounce_<domain>_com
route_list = <domain>.com
bounce_<domain>_com:
driver = autoreply
from = systems@<domain>.net
to = $sender_address
user = exim
subject = "Re: Your mail to ${local_part}\@<domain>.com"
text = "You tried to send a mail to ${local_part}\@<domain>.com."
file = /etc/mail/<domain>.com.text
A system filter to perform the first part I found quite tricky to write
using the mail command.
Opinions on how this can best be achieved would be most welcome - I
couldn't find any complete examples for inspiration
Daryl