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))
Here are the quick steps to accomplish this:
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
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.
firstname.lastname@example.org email@example.com @example.com firstname.lastname@example.org
Save and exit the file. Now we need to create the postfix db.
Now just restart postfix and test.
Restart postfix and test.