You’ve got a server and sometimes you need to send outgoing emails. Like me, you may have messed around using someone elses SMTP server. Maybe, you’ve had a go at setting up Postfix or Exim?
It’s a lot of hard work, isn’t it?
Well, I couldn’t be arsed with all that, and eventually came across the awesome opensmtpd.
If you’re on Debian 10 (Buster), make sure you’ve enabled Debian Backports in your sources.list and run:
sudo apt-get install opensmtpd/buster-backports opensmtpd-extras/buster-backports
Below is the defaut config file “/etc/smtpd.conf”
OpenBSD: smtpd.conf,v 1.10 2018/05/24 11:40:17 gilles Exp $ # This is the smtpd server system-wide configuration file. # See smtpd.conf(5) for more information. table aliases file:/etc/aliases # To accept external mail, replace with: listen on all # listen on localhost action "local" maildir alias <aliases> action "relay" relay # Uncomment the following to accept external mail for domain "example.org" # # match from any for domain "example.org" action "local" match for local action "local" match from local for any action "relay"
We’ll leave this as is, for the moment.
Next, you need to set the reverse DNS for you IP on your VPS settings page.
You’ll (usually) find this in your IP settings. All you need to do is put set RDNS or reverse DNS to your hostname. For this site, that’d be
Now we’ll set our SPF (Sender Policy Framework). As long as our A and MX records are good, we can just put this as a TXT record:
v=spf1 a mx -all
If you want to know more, here is a good article on the topic: mailtrap blog
TO BE CONTINUED…