How to check delivery capacity of your mailserver

How to test if you have got a mailserver for good delivery capacity? Follows are the simple guide.

First you want to install Postfix which will act as MTA to communicate to other mailservers.

On Ubuntu it's quite easy to install Postfix, just do:

 $ sudo apt install postfix

Just change two lines of your Postfix configuration file /etc/postfix/main.cf.

 inet_protocols = ipv4
myhostname = mail.myhost.name

The first line makes Postfix to listen on IPv4 only, otherwise you will have troubles in sending mail to gmail.

The second line specifies a valid hostname for your mailserver, it must be FQDN. That's to say, your server should have setup that hostname correctly, and hostname must be resolvable. For example, the following commands should work.

 $ hostname
mail.myhost.name

$ dig mail.myhost.name +short
179.61.xx.xx

After then, you would contact your host provider to add a rDNS for server IP. rDNS hostname should point to the same one we have mentioned above.

For instance, this command should work for the IP.

 $ dig -x 179.61.xx.xx +short
mail.myhost.name.

myhostname in Postfix is used for HELO command in SMTP session. rDNS and its name are used for IP resolution in the connection stage. Though they are in different stages, but you'd better to keep them consistent.

You have installed Postfix, setup hostname and rDNS. The next step is to install a perl module (written by me) for test sending mail.

 $ sudo apt install cpanminus
$ sudo cpanm Email::Send::YYClouds

Write the script as follows.

 use strict;
use Email::Send::YYClouds;

my $msg = Email::Send::YYClouds->new();
$msg->send(recepient => ['xx@yahoo.com','xx@gmail.com','xx@icloud.com','xx@hotmail.com','xx@gmx.com'],
sender => 'your_id@mail.myhost.name',
smtprelay => 'localhost',
subject => 'your test subject',
body => 'your test message here',
);

Now run this perl script which will send test mail to the email addresses you specified (for those big providers).

Check your inboxes to verify if they have arrived correctly.

If not arrive, you should check mail.log to find out the reasons such as IP is blocked. And contact your server provider to help improve IP reputation, though it's generally useless.

Good luck with it!