What is PHP mail and how does it differ to SMTP?
PHP mail is a built-in function of PHP. Your website calls it, and the message is handed straight to the mail system already running on the server - no mailbox to create, nothing to configure. It is the default on most content management systems.
Because there is no mailbox behind it, the message goes out from an address built from your account and server name, which is why you may recognise something like wordpress@yourcpanelusername.yourserver.cloudhosting.uk.
SMTP means creating a real mailbox on your own domain and configuring your site to send through it, signing in as that mailbox each time - so mail arrives from no-reply@example.co.uk instead.
What are the benefits to using PHP to send Mail?
Ease of use. This is the only real reason to be using PHP mail.
Our platforms (like most providers) come preconfigured to use PHP Mail on your website, this allows your site to send out update emails, contact forms, and any other messages without any kind of configuration on your part to get this working.
What are the benefits to using SMTP to send Mail?
PHP mail is the default on most content management systems, but SMTP is the better choice for anything that matters - order confirmations, password resets, contact forms.
- Deliverability. This is the real one. Mail sent by PHP goes out from the server's hostname, not your domain - so the address it claims to be from does not match the domain that authenticated it. Providers such as Gmail check that they line up (this is DMARC alignment), and mail that fails can be junked or rejected. Sending through a mailbox on your own domain makes them match.
- Recognisable sender. Customers receive email from
orders@example.co.ukrather thanwordpress@yourcpanelusername.yourserver.cloudhosting.uk- which looks like what it is, and gets deleted accordingly. - Replies work. Mail from a real mailbox can be replied to. Nobody is reading replies sent to a server hostname.
Conclusion
PHP mail is easy and it has its place, but it should not be relied on where delivery matters - order emails being the obvious case. The address it sends from belongs to the server rather than to you, and that mismatch is what gets messages junked.
If mail from your site is going missing, our guide to improving mail deliverability with SPF, DKIM and DMARC covers the records that need to be in place either way.
If you wish to convert your WordPress site to use SMTP, please take a look at this article:
Using SMTP to send emails from WordPress