Mails From EXIM To Gmail Marked As Spam

Mails from EXIM to gmail marked as spam

Sometimes it becomes complicated to manage mail deliveries in Exim due to recipient end spam filter settings. Most common issue is with Gmail marking the server mails as spam.

Follow the steps to overcome this issue

If Gmail receives mail to junk folder, check the source of the email message in Junk folder to find the Received headers in the email.

In the header check for SPF and if spf=none or soft fail. You will need to add the SPF record with both IPv4 and IPv6 addresses: v=spf1 a mx ip4:xxx.xxx.xx.xx ip6:xxxx:xxx:x:xxx:x:x:x:x –all

Mails from EXIM to gmail marked as spam

Format for a SPF TXT record with both IPv4 and IPv6 addresses: v=spf1 a mx ip4:xxx.xxx.xx.xx ip6:xxxx:xxx:x:xxx:x:x:x:x –all

In some cases, the server (Exim) have both IPv4 and IPv6 configured locally, but there is no A record for the IPv4 address. Need to add an AAAA record in the server for IPv6 address, since that’s what Exim defaults to when sending email.

Once you have your TXT and AAAA records configured, test the response with:

dig +short example.com txt (for SPF)

Mails from EXIM to gmail marked as spam

dig +short example.com AAAA (for IPv6)

Mails from EXIM to gmail marked as spam

Make sure there are Reverse DNS entries for both your IPv4 and IPv6 addresses

Send another email from the server to yourself, then view the raw source/headers.

If you still see that SPF is flagged as none, try restarting your mail service and check if the TXT record is propagated.

Now if you see that SPF is flagged as neutral or pass and still mail is considered as Spam, check if Exim is picking up the right hostname.

If Exim isn’t delivering with the right hostname, edit Exim configuration file by manually overriding the primary_hostname

vi /etc/exim.conf (on cpanel servers; other OSes may differ in the configuration path).

Uncomment the primary_hostname and set it to your server’s primary domain (should be same as Reverse DNS entry you added earlier).

Restart Exim for the change to takes effect.

service exim restart

After following through this entire process, you should see the as below

Mails from EXIM to gmail marked as spam

Note that these are the basic steps for getting emails with otherwise high-quality content delivered. If you have spammy message content (e.g. “Click this email link to win a million dollars!”), it’s very likely your message will get flagged as spam regardless of how well you set up your domain and email server.

For high volume of email delivery, DKIM record should also be added.

Praveen

Leave a Reply

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