7

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.

FarO
  • 287
  • 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 07: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 09: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 03:08

2 Answers2

5

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.

MeSo2
  • 421
  • 1
  • 9
  • 24
Organic Marble
  • 23,641
  • 15
  • 70
  • 122
  • 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: https://wiki.archlinux.org/index.php/Msmtp – nealmcb Jun 11 '19 at 21:13
  • Thanks, I will take a look at that. – Organic Marble Jun 11 '19 at 21:18
  • On Ubuntu, you should use the package, but in other cases (cough Debian cough), you should install from source so you can get TLS support, which is not enabled by default. – Rich Remer Jan 02 '23 at 23:26
1

example /etc/msmprc

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

#user #password

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

b1nch0
  • 106