SMTP vs PHP mail(): Which One Should I Use?

TO PRINT THIS PAGE — right-click on the document and select "Print" or press Crtl-P

You will often find an application that purports to send mail through the server without needing SMTP credentials. The method this application probably uses is PHP mail(). Using PHP mail() function invokes a Sendmail program.

Using PHP mail has its own unique advantages in certain niche scenarios; however, at ChemiCloud, the application to deliver mail from your application, such as WordPress, is not recommended. There are several reasons for this.

Let’s take a look at some Pros and Cons of each option:

PHP mail Pros

  1. It’s integrated into a lot of applications out of the box.

  2. Because it’s been in use on Linux for so long, it’s also connected to the default MTA (if installed), making configuration relatively easy.

PHP mail Cons

  1. Sending mail via PHP mail means the messages dispatched will not benefit from the SPF and DKIM setup on your domain. Therefore, the messages will likely be treated as spam by the receiving MTA (mail server).

  2. At Archjer Data, if you are not on a VPS, there is a limit of 25 unauthenticated messages per hour, which means if you’re dispatching an email newsletter campaign, it’s going to take a long, long time.

  3. Overall deliverability of email messages sent via PHP mail is not guaranteed.

  4. You won’t receive bounceback messages if there is a delivery failure.

SMTP Pros

  1. SMTP is a secure and proven technology.

  2. Mail sent using SMTP over your ChemiCloud email will travel through our MailChannels servers and be appropriately delivered to the recipient’s inbox instead of being treated as spam.

  3. Messages sent via SMTP will carry your DKIM and SPF signatures to notify receiving mail servers you really did send this message, and it was allowed to be sent from your domain.

  4. At Archer Data, you can send up to 300 messages per hour unless you are on a VPS.

SMTP Cons

  1. Integration into applications like WordPress may require an additional plugin.

  2. You need to create an additional user to authenticate with the SMTP server, which means another password you need to keep secure.

SMTP vs PHP mail(): Which One Should I Use?

As you can see, sending mail from your PHP application using SMTP is the better choice.

We hope this answers some questions for you, but if you still need assistance, just open a Help Desk ticket and we’ll get it sorted out!