Troubleshooting

WordPress Not Sending Emails: A Diagnostic Guide That Starts With the Cause

“WordPress is not sending emails” describes at least five unrelated faults. They have different causes and different fixes, and the standard advice — install an SMTP plugin — only addresses one of them.

That advice is right often enough to be worth trying first. But if you have already installed an SMTP plugin and mail still is not arriving, you need to know which of the remaining four you have.

First, work out which failure you have

Answer one question: does the message exist anywhere?

Install any email-logging plugin, or use one built into your SMTP plugin, and trigger the email that is failing. Then:

  • Nothing in the log at all → WordPress never tried to send. The fault is upstream, in whatever should have called wp_mail(). Go to Failure 1.
  • Logged with an error → WordPress tried and the transport refused. Read the error. Go to Failure 2 or 3.
  • Logged as sent, nothing arrives → it left your server. Go to Failure 4.
  • Logged as sent, arrives in spam → delivery works, trust does not. Go to Failure 5.

This single check saves most of the wasted effort in this topic, because it separates “never sent” from “sent but filtered” — problems that look identical from an empty inbox and share no fixes.

Failure 1: nothing ever called wp_mail()

No SMTP configuration can fix an email that was never generated. Common causes:

  • A plugin’s own notification setting is off. WooCommerce, in particular, has a per-email enable toggle at WooCommerce → Settings → Emails. A disabled “Processing order” email is not a delivery problem.
  • The recipient address is empty or wrong. Check the admin email at Settings → General, and any per-plugin notification address.
  • Another plugin is short-circuiting mail. Anything hooking pre_wp_mail can stop a message before it is sent. Disable-email plugins do this deliberately; so does an SMTP plugin’s own sandbox or log-only mode, which is easy to leave switched on after testing.
  • The triggering event is not firing. If order emails are missing, confirm orders are actually reaching the status that sends them.

Failure 2: PHP mail() is being used and the host does not support it

By default WordPress calls PHP’s mail() function, which hands the message to a local mail transfer agent. Many modern hosts do not run one, or run one that silently discards mail.

This is the failure the standard advice addresses, and for it the standard advice is correct: configure real SMTP or a provider API so WordPress authenticates to a mail service instead of relying on the server.

The symptom is characteristic — mail fails uniformly, for every message type, with no useful error, and it has never worked on this host.

Failure 3: SMTP is configured but the connection fails

Here the error message matters, and the two broad cases are easy to tell apart by timing.

Instant failure with an authentication error means the connection succeeded and the credentials were rejected. Causes:

  • Using an account password where the provider requires an app-specific password. Gmail and Outlook both require this when two-factor authentication is on.
  • The From address does not match an address the provider has authorised you to send from. Most providers reject this outright.
  • An API key with insufficient permissions.

A long hang followed by a connection timeout means the connection never opened. The usual cause is the host blocking outbound SMTP ports — 25 almost always, and often 465 and 587 as well. A typical error looks like:

SMTP ERROR: Failed to connect to server: (0)

The (0) is the tell: the connection did not get far enough to produce a real error code. Confirm with your host, and if ports are blocked, use a provider’s HTTP API instead of SMTP — API mailers go over ordinary HTTPS on port 443 and are unaffected.

Failure 4: sent successfully, never arrives

The message left your server and the provider accepted it. Something after that dropped it.

  • Check the provider’s own logs first. This is the step most people skip and it is the most informative. Every provider dashboard shows what happened after they accepted the message — delivered, bounced, suppressed. A hard bounce there is an address problem, not a WordPress problem.
  • Check the suppression list. Providers automatically stop sending to addresses that previously bounced or complained. A single test address that once bounced can be suppressed permanently, so your tests fail while real customers receive mail normally.
  • Consider the recipient’s server. Corporate mail systems reject or quarantine silently, and Microsoft-hosted domains are notably aggressive.

Failure 5: it arrives, in spam

Delivery works. What is missing is proof the message is genuinely from you. This is the authentication layer — SPF, DKIM and DMARC — and it is DNS configuration, not plugin configuration.

Send a test to a Gmail address, open it, choose Show original, and read the Authentication-Results header. You want spf=pass dkim=pass dmarc=pass.

The case that trips people up is passing SPF and DKIM but failing DMARC. DMARC additionally requires alignment: the authentication must pass for the domain in the visible From address, not merely for your provider’s domain. The fix is to complete domain authentication at your provider — publishing their DKIM records on your own domain — rather than sending on their shared identity.

Our deliverability testing guide covers reading these results and the SPF ten-lookup limit in more detail.

Telling the failures apart by their symptoms

If you would rather not install a logging plugin first, the symptoms themselves are diagnostic. Each failure has a distinctive shape.

What you observe Most likely cause First thing to check
Every email type fails, always has on this host PHP mail() unavailable Configure real SMTP or a provider API
Test hangs 10–30s then fails Host blocks outbound SMTP ports Try an API mailer on port 443
Test fails instantly with an auth error Credentials or unauthorised From address App password; From matches a verified sender
Admin mail arrives, customer mail does not Authentication or reputation Authentication-Results on a real delivery
One email type missing, others fine That notification is disabled, or its trigger never fired The plugin’s own email settings
Worked for months, stopped abruptly Expired token or edited DNS Reconnect the mailer; check DNS history
Mail arrives, but hours late Stalled queue Scheduled Actions and WP-Cron
Your test fails, customers receive mail Your address is suppressed The provider’s suppression list

The plugin conflicts that cause this

One category of failure deserves separating out, because it is invisible from every settings screen: another plugin intercepting mail.

WordPress exposes hooks that let any plugin inspect, alter or cancel a message. Several common plugin types use them, and when two do it at once the results are unpredictable.

  • Two SMTP plugins active at once. Both hook phpmailer_init, and whichever runs later wins — which may not be the one you configured. This happens most often mid-migration, when the old plugin was never deactivated.
  • Disable-email or maintenance plugins. These hook pre_wp_mail to stop messages. They are frequently installed during a build and forgotten.
  • Security plugins. Some restrict outbound connections, which breaks API mailers while leaving SMTP working, or the reverse.
  • Membership and CRM plugins. Many override the From address globally, so your carefully authenticated sender is replaced by theirs on every message.

The fastest test is the standard one, applied narrowly: deactivate everything except your SMTP plugin, send a test, then reactivate in groups. Tedious, and it settles the question in ten minutes when nothing else has.

A quicker check for the From-address case specifically — this reports what will actually be used, after every filter has run:

wp eval 'echo apply_filters( "wp_mail_from", get_option( "admin_email" ) );'

If that prints something other than what you configured, a plugin is overriding it, and that is why your authenticated domain is not being used.

Making failures visible from now on

The reason this problem recurs is that WordPress fails silently. wp_mail() returns a boolean nobody checks, and a failed message leaves no trace.

Three things change that, in increasing order of usefulness:

  1. Log every message. Not just failures — successes too, since “sent successfully but never arrived” is a different problem from “never sent” and you cannot distinguish them without both records.
  2. Alert on failure. A message that failed to send cannot reliably notify you about itself, so alerts have to go through an independent path. NimblyMail sends failure alerts using PHP’s own mail() rather than the configured transport, on the reasoning that a broken transport should not be able to suppress the warning that it is broken.
  3. Check the connection on a schedule. Logging tells you about a message that failed. A scheduled connectivity check tells you the transport is broken before the next message needs it — which matters most for the failure modes in this article that arrive with no warning, like an expired token or a host that has started blocking a port.

Two host-level causes worth knowing

WP-Cron on a quiet site. WordPress does not have a real scheduler. wp-cron.php runs when somebody visits the site, so a low-traffic site processes scheduled work erratically — including queued mail and retries. If mail arrives in bursts whenever you happen to load the site, this is why. Disable WP-Cron and run a real one:

define( 'DISABLE_WP_CRON', true );
*/5 * * * * curl -s https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

A caching or security layer intercepting outbound requests. Some managed hosts and security plugins restrict outbound HTTP, which breaks API mailers specifically while SMTP still works — or the reverse. If SMTP fails and the API works, or vice versa, suspect the host before the plugin.

Diagnosing without guessing

Two techniques that settle most arguments quickly.

Test wp_mail() directly. This removes every plugin from the question except your mailer. From WP-CLI:

wp eval 'var_dump( wp_mail( "[email protected]", "Direct test", "Body" ) );'

true means WordPress handed the message off successfully, so anything still missing is downstream — provider, filtering or suppression. false means it failed before leaving, which points at configuration or connectivity.

Capture the actual error. WordPress swallows mail errors by default. This surfaces them:

add_action( 'wp_mail_failed', function ( $error ) {
    error_log( 'wp_mail failed: ' . $error->get_error_message() );
} );

The message goes to your PHP error log and is usually far more specific than anything an interface shows you.

Why it works and then stops

Mail that worked for a year and broke last week usually has one of a small set of causes:

  • An OAuth token expired. Gmail connections built on an app still in “Testing” publishing status have refresh tokens that expire after seven days. Changing your Google account password also invalidates tokens immediately.
  • A provider policy changed. Microsoft is retiring basic authentication for SMTP AUTH, and accounts created recently may have no Authenticated SMTP option at all.
  • A DNS record was edited. Adding a second SPF record rather than merging into the existing one breaks both.
  • The site was cloned. Staging copies inherit production credentials, and OAuth tokens are bound to a site URL, so a clone’s token is invalid.

The pattern is that none of these are visible from inside WordPress. Nothing announces that a token expired; mail simply stops. Recurring automated checks on authentication and connectivity catch this class of failure at the point it happens rather than when a customer complains.

What to do, in order

  1. Log the emails and find out whether the message exists at all.
  2. If it was never generated, fix the trigger — not the mail configuration.
  3. If sending failed, read whether it timed out (ports) or was rejected (credentials).
  4. If it sent, check the provider’s logs and suppression list.
  5. If it arrives in spam, fix authentication and alignment in DNS.
  6. Put connectivity and authentication on a recurring check so the next break announces itself.
N
Ndeni

Leave a Reply

Your email address will not be published. Required fields are marked *