I work at example.net :-) and my team's server is named tardis.example.net . Any mail sent to us must first go through our company's internal relay hosts. Although the messages are delivered to our server correctly, the recipient address is rewritten from:




As a result, our default Postfix (2.6.6) configuration refuses to deliver the message:

Nov 27 15:49:23 tardis postfix/qmgr[10564]: B6CC73FA22:
from=<someguy@example.net>, size=3953, nrcpt=1 (queue active)

Nov 27 15:49:24 tardis postfix/smtp[10580]: B6CC73FA22: to=<george@example.net>,
delay=0.71, delays=0.47/0.01/0.14/0.1, dsn=5.1.1, status=bounced
(host outbound.example.net[] said: 
550 5.1.1 <george@example.net>...  User unknown (in reply to RCPT TO command))

My solution to this was to change main.cf from this:

myhostname    = tardis.example.net
mydomain      = example.net
mydestination = $myhostname, localhost.$mydomain, localhost

to this:

myhostname    = tardis.example.net
mydomain      = example.net
mydestination = $myhostname, $mydomain, localhost.$mydomain, localhost

This works fine; by accepting mail for $mydomain, tardis.example.net now accepts incoming mail even with the recipient changed to george@example.net

The problem, however, is that all outgoing mail from our server to @example.net is now treated as local mail. Instead of being forwarded to $relayhost (outbound.example.net), Postfix attempts to deliver it to a local user on tardis.example.net .

How can I configure our server to accept incoming @example.net mail, but send ALL outgoing messages to $relayhost (with the possible exception of outgoing mail destined for @tardis.example.net, which is the only thing that should be delivered locally) ?

I looked through the FAQ on mail relaying and the various relay-related options in the documentation but could not find anything that would help me.

If you need further configuration info, I'll be happy to provide it. Thanks to anyone who can help.

  • It would have been better, I think, to fix the upstream mail server that was causing the original problem. – Michael Hampton Nov 27 '13 at 22:07
  • In this case example.net is a very big company. The upstream mail administrators probably had some good reason to rewrite all addresses with a canonical @example.net, and won't particularly be interested in what our team would prefer. :-/ – George Adams Nov 27 '13 at 22:22
  • To me it looks like your postfix is changing the recipient and then tries to send that email back out, and their mail server says george@example.net does not exist. Or am I missing something? – lsmooth Nov 27 '13 at 23:08

Gah! Yes, you're right, Ismooth - I hadn't realized the difference between the to and orig_to line was coming from Postfix, not the upstream mail host. In this case, the standard distribution of Postfix loaded onto our server by the company contained the line:

masquerade_domains = example.net

which of course stripped off the "tardis" bit and turned george@tardis.example.net into george@example.net.

The solution was to remove that line, then remove $mydomain from the mydestination directive. Problem solved. Thanks for the help!

  • Don't forget to mark this answer as accepted – masegaloeh Mar 23 '15 at 15:54

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.