SMTP vs PHP mail(): Which One Should I Use?
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
-
It’s integrated into a lot of applications out of the box.
-
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
-
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).
-
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.
-
Overall deliverability of email messages sent via PHP mail is not guaranteed.
-
You won’t receive bounceback messages if there is a delivery failure.
SMTP Pros
-
SMTP is a secure and proven technology.
-
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.
-
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.
-
At Archer Data, you can send up to 300 messages per hour unless you are on a VPS.
SMTP Cons
-
Integration into applications like WordPress may require an additional plugin.
-
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!