I'm trying to redirect root mail on a CentOS 8 host to an external mail [email protected], so I get an email notifications when cronjobs fail.
The receiving mail server is on Uberspace.de. I set up a domain I own in postfix on the sending CentOS 8 host;
mydomain = mydomain.org myorigin = $mydomain
as otherwise (like when the FROM domain has no MX record) all mail sent to the recipient mail server on uberspace would be rejected with
said: 550 No MX for your FROM address (in reply to MAIL FROM command)
Testing the mail with
echo test | mail -s "test" [email protected] works.
I tried forwarding via/root/.forward
echo test | mail -s "test" root, but now mails are sent to [email protected]
I tried forwarding via /etc/aliases
root: [email protected]
sudo newaliases && echo test | mail -s "test" root, but now mails are sent to [email protected]
Has anyone some ideas how I could achieve getting all mail to root forwarded to [email protected] ?