# Sending website email with SMTP

> Why emails from your website's forms land in spam, and how sending them through SMTP with a real email account fixes it.

Source: https://helpcenter.ruachost.com/email/guides/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

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

**1. Create a sending email account.** In cPanel, [create an email account](https://helpcenter.ruachost.com/cpanel/files/managing-e-mail-accounts-in-cpanel/) 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

- 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](https://helpcenter.ruachost.com/email/guides/gmail-couldnt-verify-domain/).
- 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](https://helpcenter.ruachost.com/email/guides/email-sending-and-mailbox-limits/). Website email counts towards it.

## Related articles

- [Sending email in WordPress](https://helpcenter.ruachost.com/wordpress/guides/sending-e-mail-in-wordpress/)
- [Sending email using PHPMailer](https://helpcenter.ruachost.com/developers/php/sending-email-using-phpmailer/)
- [Fixing the "max defers and failures" error](https://helpcenter.ruachost.com/email/cpanel-email/fixing-the-max-defers-and-failures-error/)
