Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Amazon SES which in postfix 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- -r --verbose -k /opt/amazon/ses/aws_credentials.conf -e https://em -f ${recipient}

I was hoping the 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

share|improve this question

migrated from Oct 9 '11 at 1:24

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted

I believe the solution is via the canonical(5) mapping facility, which describes address cleanups to be performed with the cleanup(8) daemon:

   The optional canonical(5) table specifies an address mapping
   for local and non-local addresses. The mapping is used by the
   cleanup(8) daemon, before mail is stored into the queue.  The
   address mapping is recursive.
   Typically, one would use the canonical(5) table to replace
   login names by Firstname.Lastname, or to clean up addresses
   produced by legacy mail systems.

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 to local_header_rewrite_clients.

You provide a plain text table (typically /etc/postfix/canonical) to the postmap(1) command to build the indexed database. If the From: from Wordpress is always the same (, 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 want in the From: 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 to envelope_sender, header_sender. (By default, it also includes envelope_recipient and header_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.)

share|improve this answer
Obvious in hindsight, but if using the regex solution, Postfix must be configured with canonical_maps = regexp:/etc/postfix/canonical. :) – Søren Løvborg Mar 26 '14 at 13:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.