Environment:A staging server called "tst.myserver.com", with no DNS record pointing to it.
Trying to send email from there to myself (firstname.lastname@example.org)
Problem:$ echo foo | mail -s bar email@example.com
$ tail /var/log/mail.log
Jan 24 18:30:24 tst postfix/smtp: 46D8FC2584: to=<me@my-mail>, relay=mail.my-mail[184.108.40.206]:25, delay=0.61, delays=0.02/0.01/0.45/0.13, dsn=5.1.8, status=bounced (host my-mail[220.127.116.11] said: 554 5.1.8 <firstname.lastname@example.org>: Sender address rejected: Domain not found (in reply to RCPT TO command))
Explanation:$ cat /etc/hostname
This is the FQDN (fully qualified domain name), and Postfix appends it to the local user name.
What we wantWe'd like Postfix to append only the myserver.com and not the tst.myserver.com
A solution(figured out by reading http://www.postfix.org/ADDRESS_REWRITING_README.html)
# vi /etc/postfix/main.cf
(add this line:)
masquerade_domains = myserver.com
# postfix stop && postfix start