I have a headless server (rpi1.example.com) with two active accounts: pi and root. I would like all the emails sent to these accounts to be redirected to an external address: real@somewhere.net.
Right now I use nullmailer with the following setup:
# /etc/nullmailer/adminaddr
real@somewhere.net
# /etc/nullmailer/defaultdomain
example.com
# /etc/nullmailer/defaulthost
rpi1
# /etc/nullmailer/remotes
smtp.somewhere.net smtp
This setup works, except for addresses like pi@rpi1.example.com:
- an email to that address is generated on
rpi1.example.com - ... which sends it out via
smtp.somewhere.net - ... which then tries to resend it to the
MXofrpi1.example.com - ... which does not exist as no email is expected to arrive there
How to setup this "outbound-only" MTA which would redirect/forward all internal emails to a single address?
/etc/aliasesto specify a full email address for destination but only using the local username for the source. If you usepostfixyou would then setrelayhostandmyoriginas appropriate to send the emails to the upstream SMTP server. – Bratchley Apr 08 '15 at 10:59