Skip to content

Diagnosing silent wp_mail() failures on WordPress

WordPress wp_mail() returning true does not mean the message left the server. Here is how to tell when WordPress is lying about a successful send.

A user resets their password. WordPress shows “Check your email for the confirmation link.” The user never gets the email. wp_mail() returned true. Nothing in debug.log, nothing in the access log, nothing in the customer’s plugin email log. This is the most common deliverability ticket on a managed WordPress fleet — and the most under-instrumented. The “silent success” is a known failure mode of the WordPress mail subsystem, and the diagnosis path has nothing to do with the SMTP plugin.

What’s happening

wp_mail() calls PHPMailer internally. PHPMailer returns true if it handed the message to the configured transport without raising an exception. That transport could be:

  • The local PHP mail() function, which returns true if the local MTA accepts the message into its queue — even if the queue then bounces it.
  • An SMTP plugin, which returns true if the upstream API accepted the call — even if the upstream then rejects the message at the receiver level.
  • A wp_mail filter installed by some other plugin, which can short-circuit the send and return true without sending anything.

The truth lives downstream of wp_mail(). Five places to look, in order of how often they catch the failure:

  1. The SMTP plugin’s email log (or its absence).
  2. The upstream provider’s activity feed (Postmark, SES, SendGrid all expose one).
  3. The receiving domain’s mail server logs, if you control them.
  4. The PHPMailer SMTP debug output, which most plugins gate behind a developer toggle.
  5. The wp_mail_failed action hook, which fires only on PHPMailer exceptions.

How to verify

Capture the actual send with debug instrumentation. Add to wp-config.php:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', '/home/<account>/logs/wp-mail-debug.log');
define('WP_DEBUG_DISPLAY', false);

// Log every wp_mail attempt with PHPMailer SMTP transcript
add_action('phpmailer_init', function($phpmailer) {
    $phpmailer->SMTPDebug = 4;
    $phpmailer->Debugoutput = function($str, $level) {
        error_log("[wp_mail/$level] $str");
    };
}, 999);

// Catch silent failures
add_action('wp_mail_failed', function($error) {
    error_log('[wp_mail_failed] ' . print_r($error, true));
});

Then trigger the failing send (password reset, contact form submit) and tail the log:

wp eval 'wp_mail("you@example.com","sh-test","body");'
tail -f /home/<account>/logs/wp-mail-debug.log

If the transcript shows 250 OK from the upstream and the message still didn’t arrive, the failure is past PHPMailer — it’s at the receiver. If the transcript shows nothing at all, a wp_mail filter is short-circuiting the call.

The fix

  1. Confirm wp_mail() is actually being called. If phpmailer_init never fires, the contact form or password-reset path isn’t using wp_mail() — it’s calling mail() directly, or it’s been hijacked by a plugin that bypasses the filter.
  2. Confirm the SMTP plugin is routing the message. Some plugins only override wp_mail when their connection is fully configured. A partial config falls back to PHP mail(), which is what produced the silent failure.
  3. Confirm the upstream accepted it. If you have Postmark, SES, or SendGrid, the API call ID is in the SMTP debug transcript. Find it in the upstream’s activity feed.
  4. Confirm the receiver accepted it. This is the failure mode most operators never check. The upstream says “delivered to mail.example.com:25.” The receiver’s MTA then bounces it. Postmark and SES surface this in their bounce feeds; SMTP plugins generally do not.
  5. If the receiver is bouncing for SPF/DKIM/DMARC reasons, the diagnosis is at the DNS layer, not the WordPress layer. On an enterprise WordPress support site, all four layers are instrumented from day one.

Stack Harbor instruments enterprise WordPress support sites with the full PHPMailer trace, upstream API correlation, and bounce-feed ingestion so silent failures become loud failures. If you have a “users aren’t getting emails” ticket and the SMTP plugin’s log shows green, we can wire the missing instrumentation.