Postfix: Sender address rejected: Domain not found (in reply to RCPT TO command))

If you are trying to send emails from a local application on a CentOS machine that is not a primary mail server, then you might hit the

Sender address rejected: Domain not found (in reply to RCPT TO command))
error. In this case you need to rewrite the outgoing address that is being rejected to something that make sense with the proper domain for the users.

Here are the quick steps to accomplish this:


nano /etc/postfix/main.cf

Modify the "mydomain" variable to your email domain

mydomain = example.com

Make sure to uncomment the proper network interface. I'm usually lazy and just do all.

inet_interfaces = all

Now at the bottom of this file you need to specify the canonical map file for rewriting the address.

sender_canonical_maps = hash:/etc/postfix/canonical

Save and exit main.cf. Now we need to edit /etc/postfix/canonical

nano /etc/postfix/canonical

You need to specify the mapping of the original address to the one you want. Since in this case I just want to rewrite everything I usually add the following two lines and it seems to catch everything.


[email protected] [email protected]
@example.com [email protected]

Save and exit the file. Now we need to create the postfix db.

postmap /etc/postfix/canonical

Now just restart postfix and test.


/etc/init.d/postfix restart

Restart postfix and test.

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.