Server emails not sending or being received as spam?

Email clients are constantly improving their spam filtering, demanding higher authentication from servers to be able to successfully receive emails. This is great for the receiver, as they don’t have to worry about all the spam emails filling their inbox anymore, but not so great for the server administrator who’s genuine email alerts from the server are being marked as spam, or worse, not being received at all.

One solution is to use a transaction mail API such as MailGun or Amazon Simple Email Service (SES), both of which provide a free service up to a specified limit (even after that, it’s quite cheap) but the alternative is to make your server more genuine looking to potential receivers.

Let’s start off by getting a basic benchmark from Mail Tester. This is a great little tool to test your server’s email capabilities, whether you’re sending alerts, newsletters or password reset links. From the command line, we can send a test email directly via the command line to the email address Mail Tester has generated for us.

First, let’s create a basic text file which will contain the content of our email. Head to your home directory and create a new file using your favourite text editor:

The content I’ve used is:

Now, we can send the email to the test address:

If you don’t have the mail command, you can install it using:

Let’s head over to Mail Tester and check our score:

If you scroll down a little more, you can open up the list items to see further details:

Great, now we have a starting point, we can go through and start to improve our email authentication. Follow the instructions carefully through each item and do as much as you can. There are some very quick and easy wins you can do around DNS records for SPF, DKIM and DMARC. Something as small as this, which can be done in under an hour can drastically change the results of your authentication.

And we can see what categories we’ve made better:


In my instance, I just needed my server to send emails successfully to Gmail. Since Gmail’s spam filters are quite strict, I wasn’t able to see any emails being received whatsoever. Now with a score of 5.7, those emails get sent straight to my inbox. That’s enough for me.

Leave a Reply

Your email address will not be published. Required fields are marked *