Sending website email with SMTP
Contact forms, order confirmations and password resets from your website often land in spam, or never arrive. The usual reason is how the website sends them.
PHP mail vs SMTP
Section titled “PHP mail vs SMTP”By default, most websites (including WordPress) send email with PHP’s built-in mail() function. It’s quick to set up, but:
- the message isn’t sent from a real, logged-in email account, so receiving servers trust it less
- the “From” address is often a made-up address like
wordpress@example.com - if anything goes wrong, the website gets no error, so the email silently disappears
SMTP sends the message through a real email account on your domain, with a username and password, just like Outlook or your phone does. Receiving servers can check that the message really came from you, so it’s far more likely to reach the inbox.
Set up SMTP for your website
Section titled “Set up SMTP for your website”1. Create a sending email account. In cPanel, create an email account for your website, such as noreply@example.com or hello@example.com.
2. Enter these settings in your website (in WordPress, use an SMTP plugin such as WP Mail SMTP):
| Setting | Value |
|---|---|
| SMTP host | mail.example.com (your domain) |
| Encryption | SSL on port 465, or TLS on port 587 |
| Authentication | On |
| Username | The full email address, e.g. noreply@example.com |
| Password | That email account’s password |
| From address | The same email address |
Replace example.com with your own domain.
3. Send a test email, to an address on a different provider such as Gmail, and check it arrives in the inbox.
Improve delivery further
Section titled “Improve delivery further”- Check that your domain has SPF, DKIM and DMARC records. cPanel’s Email Deliverability tool can check and repair them. See Fixing Gmail’s “couldn’t verify” warning.
- Add a CAPTCHA to forms, so bots can’t use them to send spam from your domain.
- Remember the limit of 200 emails per hour. Website email counts towards it.