How to avoid the SPAM filters with PHP mail()


Its a coder’s worst nightmare – sending emails from scripts! I can’t think of anything I dread more when designing a website, somehow whatever I learned the last time I did it has changed drastically whenever I decide to do it again.

It isn’t just me either, coders across the globe hit the same brick wall and continuously bang their heads against it. You can re-arrange the headers as many times as you like, it isn’t going to work.

But a few months back I discovered something that really does make a big difference to SPAM filters, and should probably be the first thing you check as it can make or break your script.

When websites such as Hotmail or Yahoo receive an email, they check the IP address the email was dispatched at against the domain’s mail (MX) records. If they don’t match, it’s a classic sign of spam!

To fix this, you need to log in to your DNS settings, wherever they may be, and set up MX records that point to the same IP address PHP sends mail from. You can check the IP address of your current records at www.mxtoolbox.com.

When I corrected the MX records on my domain, emails started arriving at addresses they never had before. As far as I recall, Yahoo may actually completely block emails where the MX records don’t match – meaning they won’t even make it to the spam folder!

Let me know what you all think, and leave tips if you have any.

Want more of the good stuff? Subscribe Subscribe to RSS Feed
Related Posts:
  • No Related Post
Trackback

There are no comments on this post

Add your comment now