How to ensure inbox delivery for emails

Inbox delivery is one of the most difficult task in mailing service. Misconfigurations in mail servers will lead the genuine mail to deliver in spam folder.

We can ensure 90% inbox delivery by some simple techniques. This tutorial explains the details of essential practises related to exim mail server.

1. Server hostname shoulb be a resolving

2. Mx record should be configured as A record instead of Cname

Some of the mail providers will not accept mail if the mx of sender
domain is a Cname.

3. SPF record should contains the outgoing mail ip address of the domain

You can verify the SPF record using the tool
'http://vamsoft.com/support/tools/spf-policy-tester'

4. Configure DKIM record with correct syntax

In the latest version of Cpanel, they have updated the DKIM to use
2048-bit RSA keys. As a result the length of the DKIM record in the
cpanel increased more and the syntax is changed a little bit from
earlier. But there is a bug in this new syntax such that DKIM record
consists of and extra ' " ' mark which will not be validated at some
registrar end.

We can correct this by adding additional ' " ' marks in the DKIM record.
Please see the example given below,

DKIM record created by cpanel,

"v=DKIM1; k=rsa;
p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTijTmRut+qX7lzm7P2rHfEuudWq4pRrJO2rLjPm0PapFmzZhuLik2pHR23xgQifFzGe81BBfAyt9WCqAB9WsYM1p5ZbfEeL2Ou1/3gDHjdcsLktfZsI90e/fZVVjFWda7A66/o26C5z61DoibjUlWRABWCzZdMHzADGrQ80iNeexkcedXBx4wJAI/f482OYx"
bmjuSRMI9yl+Rf0dS+NV/OK7r4pwinWRliFrp+ku1M++2qKkMFf/rjouvL/Gsqm1mdF1LSsixRmUxxucqK4F2R/fgQrNDp3vcXL0M9FTXPRl7PVR6hm3+4fYIKxLhWmkFCGe4aEn9n58kbFVK8y/QIDAQAB\;
We need modify this as given below on adding at registrar end.

"v=DKIM1; k=rsa;
p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTijTmRut+qX7lzm7P2rHfEuudWq4pRrJO2rLjPm0PapFmzZhuLik2pHR23xgQifFzGe81BBfAyt9WCqAB9WsYM1p5ZbfEeL2Ou1/3gDHjdcsLktfZsI90e/fZVVjFWda7A66/o26C5z61DoibjUlWRABWCzZdMHzADGrQ80iNeexkcedXBx4wJAI/f482OYx"
"bmjuSRMI9yl+Rf0dS+NV/OK7r4pwinWRliFrp+ku1M++2qKkMFf/rjouvL/Gsqm1mdF1LSsixRmUxxucqK4F2R/fgQrNDp3vcXL0M9FTXPRl7PVR6hm3+4fYIKxLhWmkFCGe4aEn9n58kbFVK8y/QIDAQAB\;"

Note that some of the registars will not accept the initial and final
quotes in the DKIM. So please verify the DKIM record after configuring
it at the registrar end. I you are getting an additional quotes in
command line, remove the initial and final quotes from the TXT record.

5. Configure Rdns record for the mail ip as mail.domainname.You can add
the same by contacing DC. Also ensure that the forward and reverse
mapping and fine.

6. Configure SMTP banner as mail.domainname (should be same as that of
rdns). You can follow the below steps to configure SMTP banner in cpanel
server.

Open the exim configuration file

#vi /etc/exim.conf

Remove the below line from /etc/exim.conf

smtp_banner = “${primary_hostname} ESMTP Exim ${version_number} \
\#${compile_number} ${tod_full} \n\
We do not authorize the use of this system to transport unsolicited, \n\
and/or bulk e-mail.”

Add the below lines to /etc/exim.conf inplace of that removed line

smtp_banner = “${smtp_active_hostname}”
smtp_active_hostname =
${lookup{$interface_address}lsearch{/etc/ip_hostname}{$value}{$primary_hostname}}

Then create file /etc/ip_hostname and add ip and domain like this

192.168.1.20: mail.example.com

Restart exim Service

#service exim restart

Set readonly attribute to exim configuration file.

#chattr +i /etc/exim.conf

7. Configure DMARC record.

DMARC is a combination of SPF and DKIM. As of now Cpanel not providing
interface or script for generating this. So please use the below third
party tool for creating DMARC record and configure the same as TXT record

https://www.unlocktheinbox.com/dmarcwizard/

8. Check the mailip against RBL lists.

You can use the thirdparty tool 'http://multirbl.valli.org/' for
checking the ip blacklists. Don't forgot to give removal requests for
the listed ipaddresses.

9. Create the mailid postmaster@domainname as most of the RBL's checking
this

10. Do not use the keyword 'TEST' while sending test email. Also do not
use the same keyword as both subject and mail body. Previously mentined
this increases probability that the mail ip to be listed in RBL's

Addtionally we can verify the mail server settings using the tool
'http://mxtoolbox.com/domain/'.

That's all........

Leave a Reply

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