Guide
WordPress wp_mail Not Working: Causes, Detection, and Fixes
wp_mail() function is how WordPress sends every email. When it breaks, there’s no error page, no warning, and no notification. Here’s how to find and fix it.Guide
wp_mail() function is how WordPress sends every email. When it breaks, there’s no error page, no warning, and no notification. Here’s how to find and fix it.Every email WordPress sends - contact forms, password resets, WooCommerce orders, admin notifications - passes through wp_mail(). By default, it uses PHP’s built-in mail() function. SMTP plugins override this to route through external mail services.
The function returns true or false, but most themes and plugins ignore the return value. Even when wp_mail is not working, the form still submits and the user sees “Message sent.”
wp_mail filteradd_action('wp_mail_failed', function($error) {
error_log('wp_mail failed: ' . $error->get_error_message());
});
This logs failures to debug.log. But you have to remember to check it.
wp eval 'var_dump(wp_mail("[email protected]", "Test", "Body"));'
Returns true or false. Tells you if wp_mail is working now, but not if it was working yesterday.
Logystera’s WordPress plugin hooks into wp_mail and captures every email attempt as a structured log event. The processor derives a success rate metric. When wp_mail stops working, you get an alert with the specific error - not a vague “something failed.”
What Logystera tracks:
A WP Mail SMTP plugin auto-updated and changed the authentication method from LOGIN to PLAIN. The SMTP server rejected PLAIN auth. The plugin logged nothing visible. The contact form still showed “Thank you.” For 18 days, every email silently failed.
With Logystera, the first failed email would have triggered an alert: “wp_mail failed: SMTP Error: Authentication unsuccessful.”
If wp_mail is not working on your site right now, the evidence is in your logs. The question is whether anyone is reading them.
Logystera doesn’t guess. It derives truth from logs.
wp_mail() is WordPress's wrapper around PHP's mail() function. It applies WordPress filters (wp_mail_from, wp_mail_content_type, etc.), handles plugin hooks, and is the function that SMTP plugins replace via the phpmailer_init action. mail() is the underlying PHP function — using it directly bypasses all WordPress mail logic and any SMTP plugin you have configured.
Yes: wp eval 'var_dump(wp_mail("[email protected]", "Test", "Hello"));' If it returns false, mail is broken. If it returns true and you don't receive it, the failure is downstream (SMTP, deliverability, inbox filtering).
The plugin reports based on the SMTP server's acknowledgement — the message was accepted by the relay. From there it can still be rejected by the recipient's server or filtered to spam. SMTP plugins log "queued for delivery"; what you actually want to know is "delivered," which requires a deliverability webhook from your mail service.
For production, yes. Free Mailgun / Postmark / SendGrid / Resend tiers cover small site volumes. The deliverability difference between authenticated SMTP via a reputable service vs PHP's mail() is the difference between "arrives" and "spam folder."
Connect your site. Logystera starts monitoring within minutes.