Is there a way to change the outbound email for root, i.e instead of [email protected]
to [email protected]
?
I am using Postfix.
Is there a way to change the outbound email for root, i.e instead of [email protected]
to [email protected]
?
I am using Postfix.
Modify the aliases file to your taste. It will be in /etc or /etc/mail or /etc/postfix or any other directory depending on your MTA. You may also need to rebuild alias db or reload your MTA (see the MTA documentation).
In Postfix set:
in main.cf
I have found the solution its smtp_generic_maps (default: empty)
Optional lookup tables that perform address rewriting in the SMTP client, typically to transform a locally valid address into a globally valid address when sending mail across the Internet. This is needed when the local machine does not have its own Internet domain name, but uses something like localdomain.local instead.
Situation: I renamed the Digital Ocean Droplet (the old domain was gone), however, the root mail was still sending mails with the old domain (when executing bash scripts). The old email was visible in the email header:
Using
hostname=newdomain.com
then restarting the server did not help.Likewise this did not help:
Then I looked into
/etc/postfix/main.cf
which reveals one important line:Finally, I could pinpoint the problem down to this file:
which was still having the old entry.
So I edited the file and set the new filename.
Afterwards in SSH I executed:
newaliases
(not sure if needed)sudo service postfix restart
And voila, the mail sent is from the new email address.