PHP Mail Function vs SMTP Guaranteed Delivery

PHP Mail vs SMTP

Having problems sending email using the PHP mail function? Just because you sent an email, doesn’t mean it will arrive!

At JVF we’ve found several limitations when using PHP mail. Our main complaint is that emails sent from a web form ends up in the receivers spam/junk/bulk folders even though we set the correct headers in PHP. We also experienced Gmail users who do not receive the email at all.

If you’re experiencing the same issues, the most important thing to check first is to make sure the SMTP server is not listed in one of the many DNS-based blacklists. Here is the one we have come to trust: MXToolBox

PHP mail uses the settings in PHP.ini to send email through sendmail. Sendmail is a direct path that just hands over the mail you generated to the system’s SMTP server, but requires you to build the header for it. PHP mail does not support SMTP authentication, which is required by many mail servers. Since SMTP requires a valid login to send the mail, the headers match the rDNS records allowing a flawless delivery.

After rigorous testing it’s obvious that PHP mail may be faster since you don’t have to connect to your smtp server, but it’s not better. In the long run, SMTP email is the only way to guarantee that your email will arrive in the inbox of your receivers. So don’t waste your time with the PHP mail function, instead use a web form that requires SMTP logic.


Looking for a website development company that builds complex websites and dynamic business solutions tailored to your specific business needs? Our full-service web design company handcrafts highly functional, visually appealing e-commerce websites & mobile applications. We have successfully guided organizations big and small by transforming their online presence.

Contact us at (925) 224-9986 to learn about our responsive web design, SEO & Marketing services.