I am using Amazon SES which in postfix master.cf looks like this….
aws-email unix - n n - - pipe
flags=R user=dhiller argv=/usr/bin/perl -I/opt/amazon/ses /opt/amazon/ses/ses-
send-email.pl -r --verbose -k /opt/amazon/ses/aws_credentials.conf -e https://em
ail.us-east-1.amazonaws.com -f support@alvazan.com ${recipient}
I was hoping the support@alvazan.com would override the from address but that didn't seem to work when sending from wordpress though it works if I use command line send.
Anyone know how to configure postfix to change all emails received to have a From address before calling that above amazon perl script so my from addresses are correct?
thanks,
Dean
Best Answer
I believe the solution is via the
canonical(5)
mapping facility, which describes address cleanups to be performed with thecleanup(8)
daemon:This address cleaning can be performed both to local submissions (
/usr/sbin/sendmail
) and remote submissions (via SMTP) -- if Wordpress sends mail via SMTP. you might need to add your Wordpress hostname tolocal_header_rewrite_clients
.You provide a plain text table (typically
/etc/postfix/canonical
) to thepostmap(1)
command to build the indexed database. If theFrom:
from Wordpress is always the same (wordpress@alvazan.com
, for example), then the entry would be:If the
From:
from Wordpress changes, but the domain is always the same, you could use:If the
From:
really could be just about anything and you always wantsupport@alvazan.com
in theFrom:
headers, you could use the regex support. I'm a little leery about this, but it's an option:You should set the
canonical_classes
variable toenvelope_sender, header_sender
. (By default, it also includesenvelope_recipient
andheader_recipient
; it might not hurt to leave it alone, but (especially with that greedy regex option) could be catastrophic. It depends upon how this specific server is used.)I recommend testing late at night and make sure you test mail coming in and out of the system after making all changes. And don't forget to keep your configs under some kind of source control. (But you knew all that.)