How to solve it?
Sometimes, it becomes more complicated to manage all the mail deliveries in EXIM due to the recipient’s spam filter settings. The server in Gmail often marks emails as spam, constituting the most common issue
Solving Spam mail issues
If your Gmail ever receives the mail in the junk folder, check the email source which will be in the junk folder, and find the received headers in the email.
Now, format the SPF TXT record with both IPv4 and IPv6 addresses
v=spf1 a mx
But in some cases, the server (EXIM) has a local configuration of both IPv4 and IPv6 addresses. When there is no A record for the IPv4 address we need to add an AAAA record in the server for the IPv6 address, in which the EXIM sends emails in that format by default.
Once you got your TXT and AAAA records configured, test the response with:
dig +short example.com txt (for SPF)
dig +short example.com AAAA (for IPv6)
Make sure that there are Reverse DNS entries for both of your IPv4 and IPv6 addresses send another email from the server to yourself and then view the raw source/headers. If you still see that SPF is flagged as none, then try to restart your mail service and check if the TXT record is propagated.
Now, if you see that SPF is flagged as neutral or passed and mail is still considered spam, check whether the EXIM is picking up the right hostname. If EXIM isn’t delivering with the right hostname, edit the 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 the same as the Reverse DNS entry you added earlier). Restart Exim for the change to take effect. Now, restart the EXIM service.
After following through this entire process, you should see get as like the below image.
Additionally, to achieve a high volume of email delivery, you should also add a DKIM record.