2

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: [email protected].

Right now I use nullmailer with the following setup:

# /etc/nullmailer/adminaddr
[email protected]

# /etc/nullmailer/defaultdomain
example.com

# /etc/nullmailer/defaulthost
rpi1

# /etc/nullmailer/remotes
smtp.somewhere.net smtp

This setup works, except for addresses like [email protected]:

  • 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 MX of rpi1.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?

WoJ
  • 1,445
  • 1
  • 19
  • 38
  • fwiw you can usually use `/etc/aliases` to specify a full email address for destination but only using the local username for the source. If you use `postfix` you would then set `relayhost` and `myorigin` as appropriate to send the emails to the upstream SMTP server. – Bratchley Apr 08 '15 at 10:59
  • see my answer on this question that is not frozen, for using postfix and smtp port 587 and /etc/aliases: https://unix.stackexchange.com/a/731561/346155 – alchemy Jan 13 '23 at 00:47

0 Answers0