WordPress Not Sending Email? Set Up SMTP

Contact forms, password resets and WooCommerce orders all rely on WordPress being able to send email. Out of the box it often can’t do that reliably. Switching to SMTP fixes it.

7 min read Updated 18 November 2026

Why WordPress emails go missing

By default WordPress sends mail with PHP’s mail() function, which hands the message to whatever mail program the web server has. That causes three common problems:

  • The server can’t send at all. Many hosts disable mail() or block outgoing mail.
  • Mail goes to spam. The message comes from the web server’s IP, which isn’t listed in your domain’s SPF record and isn’t signed with DKIM.
  • No error is shown. The form says “Thank you” even when nothing was sent.

Sending through a real SMTP server (your mailbox provider or a sending service) fixes all three: mail is authenticated, signed and logged.

Choose where to send from

  • Your business mailbox (Google Workspace, Zoho, your host’s email): fine for contact forms and low volume.
  • A sending service (Brevo, SendGrid, Mailgun, Postmark, Amazon SES): better for WooCommerce, membership sites and anything over a few hundred emails a day. Each gives you SMTP credentials and helps set up SPF and DKIM.
  • Avoid Outlook.com/Hotmail accounts: they no longer accept passwords over SMTP, and most plugins’ plain SMTP mode won’t work with them.

Before configuring WordPress, confirm the credentials work with the SMTP test. That separates a settings problem from a WordPress problem.

Option 1: use an SMTP plugin

WP Mail SMTP, FluentSMTP and Post SMTP are the most widely used. The setup is the same in each:

  1. Install and activate the plugin.
  2. Choose the Other SMTP (or generic SMTP) mailer.
  3. Enter the SMTP host, port 587 with TLS/STARTTLS (or 465 with SSL), and turn authentication on.
  4. Enter the username and password. For Gmail, Yahoo and iCloud this must be an app password.
  5. Set the From email to the same address you log in with, or an address on a domain you’ve verified with the sending service.
  6. Send the plugin’s test email.

Some plugins also offer API-based mailers for specific services. Those skip SMTP entirely and can be faster, but plain SMTP works with any provider.

Option 2: configure SMTP in code

If you’d rather not add a plugin, WordPress lets you configure its built-in PHPMailer with the phpmailer_init hook. Put the credentials in wp-config.php:

define( 'SMTP_HOST', 'smtp.example.com' );
define( 'SMTP_PORT', 587 );
define( 'SMTP_USER', '[email protected]' );
define( 'SMTP_PASS', 'your-app-password' );
define( 'SMTP_FROM', '[email protected]' );

Then add this to a small must-use plugin (for example wp-content/mu-plugins/smtp.php) or your theme’s functions.php:

add_action( 'phpmailer_init', function ( $phpmailer ) {
    $phpmailer->isSMTP();
    $phpmailer->Host       = SMTP_HOST;
    $phpmailer->Port       = SMTP_PORT;
    $phpmailer->SMTPAuth   = true;
    $phpmailer->Username   = SMTP_USER;
    $phpmailer->Password   = SMTP_PASS;
    $phpmailer->SMTPSecure = SMTP_PORT === 465 ? 'ssl' : 'tls';
    $phpmailer->From       = SMTP_FROM;
} );

Set up SPF, DKIM and DMARC

SMTP gets the email sent; authentication gets it into the inbox. Add the SPF and DKIM records your provider gives you, then a DMARC record. Check each one with the SPF, DKIM and DMARC checkers.

Still not working?

  • Connection errors in the plugin log: your host may block outbound SMTP. Try port 2525, or ask the host to open 587. The port checker shows which ports the mail server answers on.
  • Test email arrives but form emails don’t: check the form plugin’s own From address. If it uses the visitor’s address as From, many servers reject it. Use your own address as From and the visitor’s as Reply-To.
  • Emails arrive in spam: see why emails go to spam.

Frequently asked questions

WordPress uses PHP’s mail function by default, which many hosts block or which sends unauthenticated mail that receivers treat as spam. Configure WordPress to send through an SMTP server with a plugin or the phpmailer_init hook.

WP Mail SMTP, FluentSMTP and Post SMTP all work well. FluentSMTP is free with no paid tier; WP Mail SMTP has the most guides; Post SMTP has good logging and resend options. Any of them can use the generic SMTP mailer with your provider’s settings.

Yes, for low volume. Use smtp.gmail.com on port 587 with an app password, and keep within Gmail’s daily sending limit. For stores or busy sites, a sending service is more reliable.