Guide To Configuring VirtualMin To Send & Receive Email

In my earlier post, I pointed out that to host a website with VirtualMin, all that one has to do is to enter the IP Address of the server into Namecheap.

In other words, we can use Namecheap’s basic DNS service and only make entries for the A and CNAME Records.

However, if you intend to use VirtualMin to send and receive emails for your domain, using Namecheap’s DNS is not feasible.

We will have to turnover the DNS entirely to VirtualMin.

Step 1: Create/ Register Personal/ Custom DNS servers.

Under the Advanced DNS tab, Namecheap allows personal / custom DNS servers to be registered.

VirtualMin DNS server entries

All that you have to do is add two entries called ns1 and ns2 and add the IP Address of the server against each of them.

Then, go to the Domain tab and change from Namecheap BasicDNS to Custom DNS.

The names of the two nameservers have to be added under Custom DNS.

VirtualMin Email Configuration

Now, it is a question of waiting for the DNS to propogate over the internet.

In my experience, it takes from 30 minutes upto 60 minutes for the propogation to be completed.

Step 2: Install Roundcube or SquirrelMail

VirtualMin has two email programmes that have a mailbox which can send and receive emails.

These are Roundcube and SquirrelMail.

Either or both can be installed through the ‘install scripts’ tab on the menu bar.

The default user has the rights to access Email.

A new user with the same privileges can be created through the Edit Users’ tab.

Likewise ‘Mail Aliases’ can be created and modified through the ‘Edit Email Aliases’ tab.

Step 3: Enable DKIM

DKIM or ‘DomainKeys Identified Mail’ is absolutely vital if email has to pass through the spam filters and reach the inbox of the recipient.

The DKIM setting is under ‘Email Settings’ > ‘DomainKeys Identified Mail’.

All that you have to do is choose ‘yes’ for the ‘signing of outgoing mail enabled’ and click the save button.

VirtualMin makes all the necessary entries to the DNS records to make the mail pass through the DKIM filter.

Step 4: Enable SPF and DMARC record

SPF, which stands for ‘Sender Policy Framework’ is another essential item to prevent emails landing up in the spam box.

The DMARC record is also a similar essential requirement.

VirtualMin enables both SPF and DMARC records to be created under the ‘Server Configuration’ > ‘DNS Options’ tabs.

The status of these settings can be verified from the Gmail Raw Headers. It will show DKIM, SPF and DMARC as ‘PASS’ if all is well or as ‘FAIL’ or ‘Soft Fail’ if it is not.

DKIM, SPF And DMarc settings

Step 5: Set up PTR Records or Reverse DNS (rDNS)

Emails which are sent without creating the PTR records or the Reverse DNS are outright rejected by the email companies.

This is the mail I received from GMail.

“This is the mail system at host mydomain.com.

I’m sorry to have to inform you that your message could not
be delivered to one or more recipients. It’s attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

The mail system

: host gmail-smtp-in.l.google.com[2a00:1450:4013:c01::1a]
said: 550-5.7.1 [2a01:…c010:30ec::1] Our system has detected that this
message does 550-5.7.1 not meet IPv6 sending guidelines regarding PTR
records and 550-5.7.1 authentication. Please review 550-5.7.1
https://support.google.com/mail/?p=IPv6AuthError for more information 550
5.7.1 . a20-v6si359419edr.179 – gsmtp (in reply to end of DATA command)
Reporting-MTA: dns; mydomain.com
X-Postfix-Queue-ID: AA7C262E0B
X-Postfix-Sender: rfc822; user@mydomain.com
Arrival-Date: Fri, 2 Nov 2018 21:42:40 +0100 (CET)

Final-Recipient: rfc822; me@gmail.com
Original-Recipient: rfc822;me@gmail.com
Action: failed
Status: 5.7.1
Remote-MTA: dns; gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 550-5.7.1 [2a01:….010:30ec::1]

Our system has detected that this message does 550-5.7.1 not meet IPv6 sending guidelines regarding PTR records and 550-5.7.1 authentication. Please review 550-5.7.1
https://support.google.com/mail/?p=IPv6AuthError for more information 550
5.7.1 . a20-v6si359419edr.179 – gsmtp”

The Reverse DNS has to be set up with the owner of the IP Address i.e. the web host.

Most webhosts like OVH, Hetzner, Scaleway etc have an option in the Control Panel to create Reverse DNS records.

This is what the option looks like in Hetzner:

virtualmin reverse dns Hetzner

Step 6: Troubleshoot SMTP errors at MXToolbox

Mxtoolbox.com is a great site to trouble shoot errors.

It tells precisely what problems are there in the SMTP server.

You can also check to see whether the IP Address is blacklisted for sending spam and whether it has a bad reputation.

MXToolbox SMTP Error VirtualMin

Step 7: Troubleshoot Email delivery errors at mail-tester.com

mail-tester.com is a good service to test the ‘spaminess’ of the mails sent from the VPS and whether it has any chance of bypassing the spam filters and making it into the inbox.

The service reveals the problems and offers suggestions on how it can be resolved.

VirtualMin Email Settings

Spam Mail VirtualMin

1 thought on “Guide To Configuring VirtualMin To Send & Receive Email

Leave a Reply

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