I have a home server which needs a mail server for error messages, mostly.

I used postfix but I find the features/complexity compromises not optimal for my home server: there are tens of lines to check/configure, stunnel to install for TLS, ...

What simpler mail server with TLS support can I use, that is also packaged by Canonical? I'm going to only use an external relay server provided by my provider.

  • Why do you use a mailer for system notifications? Mailers are complex because they were built for another purpose - general mail. For system notifications only you can replace sendmail with a batch file 30 lines in length - no need for a server. That batch file can open a connection your provider and send mail via a call to python "sendmail". Or you can call an API - lots of companies offer that for free now. – Craig Hicks Mar 11 '19 at 7:52
  • @CraigHicks I see you posted the script but it was downvoted because OT for this question (I got it, thanks, even if it involves more work than I expected based on the question I asked). I suggest asking a question specifically for your script and then answer yourself with the same post you deleted, because it could be quite useful to many people. – FarO Mar 11 '19 at 9:52
  • It was OT, that why I deleted it. Take a look at this question about minimalist self-"coded" servers and plain senders. All SMTP, since your provider will forward for you. Good luck in whatever you choose! – Craig Hicks Mar 11 '19 at 12:02
  • 1
    See also a more recent and extensive set of options, including msmtp, at Lightweight outgoing SMTP server - Unix & Linux Stack Exchange – nealmcb Jun 12 '19 at 3:08

A simple relay-only mail transport agent is nullmailer.

There is a good configuration guide here: http://www.troubleshooters.com/linux/nullmailer/

That configuration guide is old enough that it omits one important configuration file: /etc/nullmailer/allmailfrom. Put just the email address you want the mail to be sent From in there. This helps tremendously when configuring various applications to send mail.

| improve this answer | |
  • That web site suggests installing the package from source, but that means you won't get security updates etc. Surely here on AskUbuntu we should recommend using sudo apt get nullmailer? – nealmcb Jun 11 '19 at 20:43
  • I personally used your method to install it. Actually by the time I got to the guide, I had installed it already, and was looking for config help. I didn't even look at the install part. Thanks! – Organic Marble Jun 11 '19 at 20:47
  • Thanks. But have they fixed the nasty "show your password to all local users" security bug referred to there? Who wrote this thing? – nealmcb Jun 11 '19 at 20:51
  • No idea. But when I ran screaming from Postfix, it was a godsend. – Organic Marble Jun 11 '19 at 20:52
  • 1
    Something simpler than postfix is good. I see lots of recommendations for msmtp e.g. documented here in ways that make me think they were more security-conscious: wiki.archlinux.org/index.php/Msmtp – nealmcb Jun 11 '19 at 21:13

example /etc/msmprc

#logfile   /var/log/mail.log
aliases               /etc/aliases.msmtp

# Use startTLS on port 587
port 587
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

host mailserver.net
from Sender Name <user@maildomain.com>
auth on
#auth plain
#auth scram-sha-1

user user@maildomain.com
password YourUnGuessueAblePass

# Set a default account
#account default : outlook

example /etc/aliases.msmtp

mailer-daemon: user@maildomain.com
postmaster: user@maildomain.com
nobody: user@maildomain.com
hostmaster: user@maildomain.com
usenet: user@maildomain.com
news: user@maildomain.com
webmaster: user@maildomain.com
www: user@maildomain.com
ftp: user@maildomain.com
abuse: user@maildomain.com
noc: user@maildomain.com
security: user@maildomain.com

# Send root to Joe and Jane
root: user@maildomain.com

# Send everything else to admin
default: user@maildomain.com
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.