I have a development server, and at the moment email is disabled on it, so we can do whatever we need to with the system without worrying about accidentally emailing clients' customers.

I'd like to set up Postfix (or something similar) to route all email from that machine to a specific, single address, no matter who it is addressed to or which domain name they are using.

I've tried this, with no success (the BCC works, but the email still goes to the original recipient):

local_recipient_maps =
luser_relay = development@domain.com
always_bcc = development@domain.com

I'm using Ubuntu server 10.04, pretty standard LAMP setup.

1 Answer 1


You will need to do address mapping in the canonical table. Add the following to /etc/postfix/canonical:

/^.*$/   your@address.com

and run postmap afterwards

postmap canonical

This should do it.

  • I'm probably doing this wrong, but I didn't get very far. There was no /etc/postfix/canonical file, so I created one with the text above. I then ran "postmap canonical", but got this error: "postmap: fatal: open canonical: No such file or directory"
    – Dave Child
    Feb 11, 2011 at 12:13
  • 1
    Before running "postmap canonical" cd into /etc/postfix or run "postmap /etc/postfix/canonical" .
    – rems
    Feb 11, 2011 at 12:22
  • 1
    Also, in /etc/postfix/main.cf you should have a line "canonical_maps = hash:/etc/postfix/canonical" .
    – rems
    Feb 11, 2011 at 12:23
  • 1
    All sorted - thanks rems! I had a couple of issues, which I'll outline here in case anyone else comes looking for this. I didn't realise what postmap was doing, first. So to do the above, I created a text file (/etc/postfix/canonical) with the first line from rems. I then ran postmap from the postix directory, and that generated a database file used by postfix (canonical.db). The line added to main.cf doesn't use the .db extension, but does look for the .db file. Finally you need regexp: instead of hash: if using a regex pattern as above.
    – Dave Child
    Feb 11, 2011 at 12:52
  • ups, sorry, yes, it should have been a "regexp:" not a "hash:". I did copy & paste from the wrong main.cf.
    – rems
    Feb 11, 2011 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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