AI Summary
Do you want to figure out why wp_mail is not working and fix it?
Problems with the wp_mail() function are very common for WordPress users. When it isn’t working properly, your WordPress emails stop sending, which quickly becomes a big problem across your whole site.
The good news is that wp_mail is usually easy to fix. In this guide I’ll walk you through the simplest way to solve wp_mail() issues so your emails reach the inbox reliably, without writing a single line of code.
What Is wp_mail?
wp_mail() is the built-in PHPMailer function that generates and sends your WordPress emails. By default, almost every WordPress plugin uses wp_mail() to send mail. The problem is that the function isn’t very reliable on its own, so when something goes wrong with it, you see email delivery issues everywhere on your site.
Why wp_mail Is Not Working
There are a few common reasons wp_mail() may not be working for you:
- PHP mail is disabled by your web server: The PHP mailer is an insecure way to send email and is easily abused by spammers, so many hosts disable it on their servers. Since
wp_mail()relies on PHP to send mail, it fails whenever PHP mail is switched off. - Your emails are being marked as spam: The
wp_mail()function was built for simplicity, so it doesn’t add authentication to prove your emails come from a legitimate source. Without that, mailbox providers treat your messages as spam and they never reach the inbox. - Your site is running on localhost: If your site is still in local development,
wp_mail()can’t send email at all, because localhost has no mail server. You need an alternative like SMTP to send mail reliably. - Your From address isn’t authorized: By default WordPress sends from an address like
[email protected]. If that mailbox doesn’t actually exist or isn’t authorized to send for your domain, mail servers reject the message. WP Mail SMTP’s Force From Email setting fixes this by sending everything from a verified address you control.
The good news is that all of these problems have a single solution, and that’s the WP Mail SMTP plugin.
How to Fix wp_mail the Easy Way
The easiest way to fix every one of these problems is to reconfigure wp_mail() to send through SMTP instead of relying on PHP. The simplest way to do that is with WP Mail SMTP.


The plugin reconfigures your site to use SMTP, a proven sending method that adds proper authentication to your messages. It also routes your email through a dedicated third-party provider instead of your web host, so your deliverability stays reliable.
On top of that, WP Mail SMTP includes extra features like:
- Email error tracking
- A weekly email summary
- Detailed email logs
- And more
Here are the five steps to fix wp_mail.
1. Install the WP Mail SMTP Plugin
The free version of WP Mail SMTP is enough to fix wp_mail(), so most people can start there. In your WordPress dashboard, go to Plugins » Add New, search for “WP Mail SMTP,” then click Install Now and Activate.


If you’ve purchased a paid plan, you’ll install it slightly differently. Head to your WP Mail SMTP account dashboard, open the Downloads tab, and click Download WP Mail SMTP.


Back in your WordPress dashboard, go to Plugins » Add New » Upload Plugin, choose the zip file you just downloaded, then click Install Now followed by Activate Plugin.


Either way, activating the plugin launches the Setup Wizard automatically. If it doesn’t, you can start it yourself by going to WP Mail SMTP » Settings and clicking Launch Setup Wizard.


2. Connect to a Mailer Service
The Setup Wizard lets you choose a third-party mailer to send your emails, which replaces the unreliable default web host. To begin, click Let’s Get Started.


You’ll see a list of recommended mailers on the next screen. You can choose any of them, and if you’re just getting started, a great option is the free trial of SendLayer.


It’s worth reading up on the different transactional email providers before you decide. Once you’ve picked one, click the matching link below and follow its setup doc:
The Google Workspace / Gmail mailer works in the free version, though its no-config One-Click Setup is a Pro feature (in free, you connect it with a manual Google Cloud app). Follow the instructions in your chosen doc, then come back here to finish up.
Want to set up more than one mailer? You can add them under Additional Connections, then set a Backup Connection and configure Smart Routing.
3. Enable Detailed Email Logs (Optional)
Once your mailer is connected, the Setup Wizard asks which email features you want to enable.
Improved Email Deliverability and Email Error Tracking are on by default and can’t be turned off, but I’d also recommend turning on Detailed Email Logs.


When enabled, the log keeps a record of every email your site sends, along with a lot of useful data in Complete Email Reports, such as:
- Opens and clicks in your WordPress emails
- Number of attachments
- Email delivery status
- Date and subject of each email
- The option to resend or forward failed emails
- And more


The Weekly Email Summary is a handy way to monitor performance. When it’s on, you get an email each week summarizing:
- Total emails sent in the past week
- Confirmed email deliveries
- Unconfirmed deliveries
- Failed emails
That summary makes it easy to tell at a glance whether your wp_mail function is working and to catch errors as they appear.


The Instant Email Alerts feature notifies you the moment an email fails to send, so you can fix the problem before your users miss anything important.


If you want to stay on top of your email at all times, I’d enable these extra features to get the most out of WP Mail SMTP. Email Logs, the Weekly Summary, and Instant Alerts are Pro features.
4. Perform an Email Test
After the steps above, the Setup Wizard sends a test email to confirm everything is configured correctly. If your setup is sound, you’ll see a success message.


At this point it’s worth letting a few real emails generate so you don’t run into the “could not instantiate mail function” error again. If you don’t want to wait, go to WP Mail SMTP » Tools » Email Test to send a few test emails yourself.


Here’s what the test message looks like when it arrives, so you know what to expect. Seeing it confirms your emails will now send successfully.


5. Resend Failed Emails Instantly
You can resend failed emails straight from the WP Mail SMTP email log. For this to work, you’ll need to have turned on the Store the content for all sent emails option in the Setup Wizard.
If you didn’t, switch it on under WP Mail SMTP » Settings » Email Log. Then, to resend an email, go to WP Mail SMTP » Email Log in your WordPress dashboard.


You’ll see a list of every email sent from your site. Any that failed are marked with a red dot. Click View Log for the failed email.


On the right-hand side, under the Actions tab, you’ll find the Resend button. Edit the email address if you need to, then click YES to resend.


And that’s it! You’ve fixed the wp_mail() function by switching it over to the far more reliable SMTP, and you’ve learned how to resend any emails that fail.
FAQs on Why wp_mail Is Not Working (& How to Fix It)
The wp_mail() function not working is a popular topic among our readers. Here are answers to some common questions about it.
Why is wp_mail not sending emails in WordPress?
WordPress uses the PHP mail function, which many web hosts block. That’s why emails often fail to send.
How do I fix wp_mail() not working in WordPress?
You can fix it by installing WP Mail SMTP. It connects your site to a proper email service that handles delivery the right way.
What causes wp_mail to fail in WordPress?
The most common cause is the hosting server blocking PHP mail. Missing email authentication, an unauthorized From address, or plugin conflicts can also cause it. Setting Force From Email in WP Mail SMTP resolves the From-address problem.
How do I test if wp_mail is working properly?
Install WP Mail SMTP and use its Email Test tool. It shows whether your site can send emails or if something’s broken.
Can WP Mail SMTP fix wp_mail issues?
Yes. WP Mail SMTP fixes wp_mail by routing it through a trusted email service like SendLayer, Brevo, or SMTP.com.
What is the best way to troubleshoot wp_mail problems?
Start by sending a test email with WP Mail SMTP. Then check your mailer settings and make sure your DNS records are correct.
Why does my contact form not send emails using wp_mail?
If your form plugin uses wp_mail and your site isn’t set up with SMTP, the server may block the message or mark it as spam.
How do I enable wp_mail on my server?
You don’t. It’s built into WordPress, but many hosts block it. Use WP Mail SMTP to connect to a proper mailer instead.
Next, Send Emails With Attachments
Would you like to send emails with file attachments from WordPress? See our guide on sending WordPress emails with file attachments from your forms or other plugins.
And if your Elementor forms are giving you trouble, here’s what to do when Elementor contact forms don’t send emails.
You might also want to improve your WordPress SEO. See our guide to the best WordPress SEO plugins to grow your organic traffic.
Ready to fix your emails? Get started today with the best WordPress SMTP plugin. If you don’t have the time to fix your emails, you can get full White Glove Setup assistance as an extra purchase, and there’s a 14-day money-back guarantee for all paid plans.
