You are not logged in.
On a previous, Debian-based system, I used exim to send system mail (e.g. from cron) to both local mail and an external email account. Hence, /etc/aliases was set up like this:
mailer-daemon: postmaster
postmaster: root
www-data: root
...
root: pi
pi: pi, external@email.com
This meant that all mail was sent to both pi's local mailbox, and also to the external account.
I've since installed Arch on my server, and instead installed msmtp, msmtp-mta, and s-nail, as per the wiki's recommendations. I've also edited /etc/msmtprc as necessary, including a reference to /etc/aliases. Can msmtp send to both local and external mailboxes?
Msmtp is working fine at a base level, e.g. with
echo "test" | mail -s "test message" external@email.com
However, if I invoke /etc/aliases as per above, I get an error.
$ echo "test" | mail -s "test message to root" root
sendmail: /etc/aliases: Too many redirects when expanding alias root.
Despite the message referring to root, I thought that maybe msmtp didn't like the recursive pi to pi redirect. So to test, I removed the pi line. If I now try to send to pi directly, I get a different error.
$ echo "test" | mail -s "test message to pi" pi
sendmail: recipient address pi not accepted by the server
sendmail: server message: 550 5.1.1 <pi>: Recipient address rejected: User unknown in local recipient table
sendmail: could not send mail (account default from /etc/msmtprc)
Presumably msmtp is connecting to the external SMTP server, and attempting to send to the faulty email address "pi". I tried things like sending to pi@localhost and pi@<hostname>. Neither showed an error, but neither were delivered locally.
The msmtp page and the wiki only show examples of aliases directing to external addresses, but this suggests that local mail may be possible. Is it indeed possible to configure msmtp to send local mail?
Last edited by Salkay (2020-01-04 03:23:28)
Offline
Offline
Yep, I've just realised it's off-topic. Apologies.
Offline
The msmtp page and the wiki only show examples of aliases directing to external addresses, but this suggests that local mail may be possible. Is it indeed possible to configure msmtp to send local mail?
msmtp sends emails, to smtp server. it doesn't do any local delivery on its own, so you can only make the local machine be the server. so you might need some flavor of https://wiki.archlinux.org/index.php/Op … Local_mail or similar.
the linked question also seems to be primarily about aliases that in the end, resolve to a full email address anyway ( mailer-daemon -> postmaster -> root -> something@gmail.com )
Offline
Thank you @frostschutz! That was the general sense I got too. I'll investigate OpenSMTPD.
(FWIW the linked question doesn't entirely resolve to an external email address. Everything goes to root, but then root splits to both a user account and an external email. Thanks again!)
Offline