If you have scripts or other services that run as root that need to send to outside email addresses, via postfix, without being root@hostname, this is what you need to do:
-
- sudo vi /etc/postfix/generic
root name@tld.com
- sudo vi /etc/postfix/main.cf
smtp_generic_maps = hash:/etc/postfix/generic
- sudo postmap /etc/postfix/generic
- sudo systemctl restart postfix
- sudo vi /etc/postfix/generic
Done! Now root will send as name@tld.com instead. Substitute whatever you want for name@tld.com