PHP Mail() Function Not Working in Windows Server

I recently had a problem trying to send email using the PHP Mail function on Windows Server and it appears that PHP mail() function don’t work perfectly in Windows mail servers. So, when your mail goes to anyone who uses a Windows mail server (comcast, gmail, and maybe aol), the recipients won’t get it.

To test if mail() function exist in your server you can try this few lines of codes.

If the result above is false/mail is disabled then maybe you need to add the solution I’ve provided below or else of course your mail() code does not formatted correctly.

First Steps:

Second Steps:

If first steps doesn’t work for you then you need to look a bit in your code header area.

You need to remove Friendly Name in your headers to work as PHP running on Windows doesn’t parse these headers correctly.

That’s it, so you can now send email to both linux and windows server, if you have other solution you can share it below.

by Ryan Sutana