Posted in Server

Server Level Optimization to Avoid Spam Filter on Email Sent from SMTP

Server Level Optimization to Avoid Spam Filter on Email Sent from SMTP Posted on May 10, 2020Leave a comment
I'm Hari Prasad Chaudhary from Nepal, developer of the finest educational website/app "MeroSpark" and the finest eCommerce system "PasalaY". Here I share the code snippet which I learn during development.

You might be using email service for your system and you are sending it using SMTP (Simple Mail Transfer Protocol) but your emails are going to junk folder of user’s inbox. If you have tried everything on email content then have a look at the point below whether you have configured your server to sent email more authentically.

Try to open your email message in Gmail, and go to Show Original option and you will see the raw data of email like below.

Original Message
Original Message View

Check if there is SPF, DKIM, and DMARC authentication is Passed or failed. If it’s failed then whatever you try, it will never get out of spam folder. Let me explain what are these authentication.

  • Sender Policy Framework  (SPF) – It ensures who you are. For example, you are sending an email message from the domain name “[email protected]”, but “youremail.com” is not your domain or your server IP is miss-matched, then it will fail. It means, this authentication ensures that email is generated from the valid origin server.
  • Domain Keys Identified Mail (DKIM) – DKIM is a technology that was developed by Cisco and Yahoo. You can simply understand, it is a digital signature of the sender. DKIM helps the receiver to ensure that the email is authorized and sent by the sender who is responsible for the domain. Gmail and Outlook blocks or prevents if the email is not signed with DKIM.
  • Domain-Based Message Authentication Reporting and Conformance (DMARC) – It is a rule to uses Sender Policy Framework, (SPF)  and Domain Keys identified mail (DKIM) to ensure the authenticity of an email message. 

Now Let’s Configure SPF and DKIM on Server using cPanel: Login to your cPanel and go to “Email>Email Deliverability>Select Domain“, or “Email>Authenciation” in the old version of Cpanel.

Email Delivery

In case if you haven’t installed these records on your DNS then you will see a button “INSTALL THE SUGGESTED RECORD” click on it for DKIM and SPF both.

Do it the same for SPF as well. You can set up SPF and DKIM by adding a DNS record. You can use SPF Record Generator or any other DKIM record generator and add the TXT record to your DNS.

Configuring DMARC on your server:

Go to DMARC record generator and enter your domain name to generate record. And choose “Quarantine it for further analysis” policy.

DMARC Record

Set your reply email on SPF and DKIM fails, at least one email. And configure other settings and finally you will get the DNS record like below:

DMARC Record text.

Add this record to your DNS and try to send emails again. It may take some time to take effect. If you have any confusion, then ask me a question below. I will try to sort it out.

I'm Hari Prasad Chaudhary from Nepal, developer of the finest educational website/app "MeroSpark" and the finest eCommerce system "PasalaY". Here I share the code snippet which I learn during development.

Leave a Reply

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