WordPress Troubleshooting

How to Fix WordPress Not Sending Emails

Why WordPress emails fail or land in spam, and the reliable fix: send through SMTP or an email API, set up SPF, DKIM and DMARC, test with a log, and debug wp_mail failures.

WordPress wp_mail sending through an SMTP service with SPF, DKIM and DMARC checks passing into an inbox

WordPress emails usually fail because WordPress sends them with PHP's mail() function through the web server, which many hosts restrict and most inbox providers distrust. The reliable fix is to send all mail through an authenticated SMTP server or an email API (your domain's mail provider or a transactional service), set the From address to your own domain, and publish SPF, DKIM and DMARC records for that domain. Then log every email so you can see what was sent.

How WordPress sends email

Everything (password resets, new user notices, form notifications, WooCommerce and LMS emails) goes through wp_mail(), which uses the bundled PHPMailer library. By default PHPMailer hands the message to the server's local mail program. The message leaves from your web server's IP, often with a From address like wordpress@yourdomain.com that no mailbox or DNS record vouches for. Gmail, Outlook and others then reject it or file it as spam.

Step 1: Confirm the problem

  • Send a password reset to an address you control at Gmail and at another provider. Check spam.
  • Install an email log plugin (for example WP Mail Logging) to see whether WordPress tried to send at all.
  • If nothing appears in the log, the problem is upstream: the form plugin is not triggering email, or a scheduled email depends on cron (cron not running).
  • If it was sent but never arrived, it is a delivery problem: continue below.

Step 2: Send through SMTP or an email API

Use an SMTP plugin (WP Mail SMTP, FluentSMTP, Post SMTP and others) to route wp_mail() through:

  • your mailbox provider's SMTP (Google Workspace, Microsoft 365, Zoho) for low volume; or
  • a transactional email service (Amazon SES, Postmark, Mailgun, SendGrid, Brevo) for stores, memberships and LMS sites that send many emails.

Developers can configure PHPMailer directly in a small plugin instead:

add_action( 'phpmailer_init', function ( $mailer ) {
    $mailer->isSMTP();
    $mailer->Host       = 'smtp.example.com';
    $mailer->Port       = 587;
    $mailer->SMTPSecure = 'tls';
    $mailer->SMTPAuth   = true;
    $mailer->Username   = SMTP_USER;      // defined in wp-config.php, not in code
    $mailer->Password   = SMTP_PASS;
} );

Keep credentials out of the database and version control by defining them in wp-config.php. More hooks in WordPress mail hooks.

Step 3: Set a proper From address

Use an address on your own domain that matches the sending service, such as hello@yourdomain.com. Never send "from" a Gmail or Yahoo address through another server: those providers' DMARC policies tell receivers to reject it. Form plugins often have their own From setting; make it match.

Step 4: Authenticate your domain

RecordWhat it doesExample
SPF (TXT)Lists servers allowed to send for your domainv=spf1 include:_spf.google.com include:amazonses.com ~all
DKIM (TXT/CNAME)Cryptographic signature proving the message is genuineProvided by your mail service
DMARC (TXT at _dmarc)Tells receivers what to do when SPF/DKIM fail, and sends reportsv=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com

Only one SPF record per domain is allowed; merge includes into it. Since 2024, Gmail and Yahoo require SPF or DKIM for all senders and DMARC plus both for bulk senders, so these records are no longer optional.

Step 5: Test and monitor

  • Send a test from the SMTP plugin and read the result.
  • Check headers of a received message: spf=pass, dkim=pass, dmarc=pass.
  • Use a deliverability checker such as mail-tester.com.
  • Keep the email log on, with a sensible retention period.

Debugging wp_mail failures in code

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

Common messages: Could not instantiate mail function (server mail disabled; use SMTP), SMTP connect() failed (wrong host or port, or the host blocks outbound SMTP; try port 587 or 2525, or an HTTP API), Authentication failed (wrong credentials or an app password is required).

Common mistakes

  • Two SMTP plugins configured at once.
  • From address on a different domain than the authenticated one.
  • Multiple SPF records, which makes SPF fail entirely.
  • Sending newsletters through the same channel as transactional email.
  • Assuming email works because the form shows "Thank you".

Frequently asked questions

Why does WordPress not send emails?

The host blocks or limits PHP mail, or messages are sent without domain authentication and rejected or filtered as spam.

Do I need an SMTP plugin?

You need authenticated sending. A plugin is the easiest way; a short phpmailer_init snippet does the same.

Why do WordPress emails go to spam?

Missing or failing SPF, DKIM or DMARC, a mismatched From domain, or sending from a server IP with a poor reputation.

Which email service is best for WordPress?

Your existing mailbox provider is fine for a few emails a day. For stores and LMS sites, a transactional service gives better deliverability and logs.

Conclusion

Stop relying on the web server's mail function: send through authenticated SMTP or an API, from your own domain, with SPF, DKIM and DMARC in place, and keep a log. Most "WordPress not sending emails" problems disappear for good. References: wp_mail() and Google's email sender guidelines. For LMS notifications, see Tutor LMS emails not sending.

Need email delivery sorted properly? Talk to our team.

Save this practical guide

Add us as a preferred Google source, or ask an AI assistant to summarize this page and link back to the original guide when it is useful.

· Tutor LMS developers

Guides written and reviewed by the TutorLMS Expert development team. Every hook, function, table and setting we mention is checked against the Tutor LMS and Tutor LMS Pro source code before it is published.

Keep reading

Need a custom Tutor LMS solution?

Tell us what you are building or what is broken. A Tutor LMS developer reads every inquiry and replies with next steps and a free estimate.

Get a free Tutor LMS consultation

Tell us what you are building or fixing. A Tutor LMS developer replies with honest advice and next steps.

  • No obligation
  • Tutor LMS and Pro specialists
  • Your details stay private

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.