Q&A: Can I use another sender address for systemmails?

Question
I want to change the sender address for systemmails from root@somemachine.example.com to systemmail@example.com. How can I do this?

Answer
You can use Postfix Address Rewriting - Generic mapping for outgoing SMTP mail.

echo 'smtp_generic_maps = hash:/etc/postfix/generic' >> /etc/postfix/main.cf.local
echo 'root systemmail@example.com' >> /etc/postfix/generic
postmap /etc/postfix/generic
ucr commit /etc/postfix/main.cf 
service postfix restart
2 Likes
Mastodon