Exercises in email self-hosting (3) Minimal - Sending

Now we will make a very small next step. We're not yet looking at IMAP, webmail, and more broad SMTP sending, but keeping it simple so that we can more easily troubleshoot problems, and hopefully better understand what is happening.

First thing that is important for sending out email, is to set your reverse DNS or PTR (if your VPS does not have that set yet. If it does, you can leave it as it is). Usually that is not set when you just rented a brand new VPS. Look up the PTR/reverse DNS field in the admin settings of your VPS, and point it to your test sub domain (In our example in the previous article we used mailtest.testdomain.live Use your own for the PTR settings.) We are not yet going to look at things like DKIM, SPF, DMARC, but only focusing on the reverse DNS or PTR for now for simplicity reasons.

After following the previous "Receiving" blog article, ssh back in to your VPS, and install bsd-mailx package.

sudo apt-get install bsd-mailx

This will provide a small program called "mail". Now log in as your "testuser" user (or use "su - testuser" if that is more appropriate).

Type in :

mail -s Here some test subject line me@foobar.live

(Replace me@foobar.live by a regular email address that you already use)

If that went well, you can jump to the next line , and start writing the body of your test email. If you are finished with that, then press to create an empty line, then press and write a . (dot) character and press enter. You should see a Cc: prompt, you can ignore that and press to finish this session.

Now do a : sudo tail -f /var/log/mail.log

and see whether the email went out correctly. Check the Inbox and Junk mail folder at your regular email account where you did send the test email to.

It is possibly that your email got completely blocked or went to your Junk mail folder. If it did go to the Junk mail folder, you can look at the email message headers to look for reasons it was marked as spam.

Hopefully this worked out fine, or at least gave you some first ideas about email sending hands on.