### [Why wp_mail Is Not Working (& How to Fix It)](https://wpmailsmtp.com/why-wp_mail-is-not-working/)

**Published:** December 29, 2021
**Author:** Osama Tahir

**Excerpt:** Is the wp_mail function not working for your WordPress site? The default email sending process for WordPress is known to be unreliable. Using WP Mail SMTP, you can avoid all the problems caused by wp_mail() and send emails using a 3rd party provider instead. In this post, we'll walk you through the process step by step.

**Content:**

Do you want to figure out why wp\_mail is not working and fix it?

Issues with the `wp_mail()` function are very common for WordPress users. And when it’s not working properly, your WordPress emails won’t send (which is a big problem).

But it’s very easy to fix `wp_mail()`. In this post, we’ll show you the simplest way you can solve `wp_mail()` issues to make sure your emails always reach your recipients without fail.

[Fix Your WordPress Emails Now! 🙂](https://wpmailsmtp.com/pricing/)

### What Is wp\_mail?

`wp_mail()` is a PHPMailer function that generates and sends your WordPress emails. By default, almost all WordPress plugins use `wp_mail()` to send emails. But the `wp_mail()` function is not very reliable. So when something goes wrong with it, you’ll find email delivery issues across your whole site.

### Why wp\_mail Is Not Working?

There are a few common reasons why `wp_mail()` may not be working for you:

- **PHP mail is disabled by your web server:** The PHP Mailer is an insecure way of sending emails and it can be exploited by hackers and spammers. This is why many web hosts disable the PHP Mailer on their servers. Since `wp_mail()` relies on PHP to send emails, it fails to work when PHP is disabled on your web host.
- **Your emails are being marked as spam:** A big problem with the `wp_mail()` function is that it was only designed for simplicity. So the emails generated by this function don’t include any authentication information to show that the email is coming from a legitimate source. As a result, your emails are seen as spam and never reach the inbox of your recipient.
- **Your site is running on localhost:** If your site is still under development, then you won’t be able to send any emails with `wp_mail()`. This is because `wp_mail()` isn’t supported on localhost. Instead, you’ll need an alternative email delivery method like SMTP to generate and send emails reliably.

The good thing is, there is a single solution to all of these problems with wp\_mail not working. And the solution is to use the WP Mail SMTP plugin.

## How to Fix wp\_mail the Easy Way

The easiest way to fix all problems with the `wp_mail()` function is to reconfigure it to use SMTP rather than relying on PHP. The easiest way to achieve this is by using WP Mail SMTP.

![WP Mail SMTP Email Deliverability illustration](https://wpmailsmtp.com/wp-content/uploads/2020/05/WP-Mail-SMTP-infographic-e1692315168103-1024x716.png)This plugin configures your WordPress site to use SMTP, which is a proven method of sending your emails because it adds proper authentication to your messages.

Moreover, this plugin sends your emails through a dedicated 3rd party email service provider rather than your default web host. As a result, your email deliverability is always guaranteed.

In addition, WP Mail SMTP comes with a bunch of extra features like:

- Error tracking
- Weekly email summary
- Detailed email logs
- … and more

- [1. Install the WP Mail SMTP Plugin](#1-install-the-wp-mail-smtp-plugin)
- [2. Connect to a Mailer Service](#2-connect-to-a-mailer-service)
- [3. Enable Detailed Email Logs Optional)](#3-enable-detailed-email-logs)
- [4. Perform an Email Test](#4-perform-an-email-test)
- [5. Resend Failed Emails Instantly](#5-resend-failed-emails-instantly)

### 1. Install the WP Mail SMTP Plugin

To start with, you’ll need a paid [WP Mail SMTP subscription](https://wpmailsmtp.com/pricing/) or the [free version](https://wordpress.org/plugins/wp-mail-smtp/). You can get either to fix wp\_mail() issues but the free version doesn’t include advanced features like the weekly email summary and email logs.

When you’ve purchased your plan, head over to your WP Mail SMTP dashboard and navigate to the **Downloads** tab. Scroll down to click on the **Download WP Mail SMTP** button.

![Download WPForms plugin](https://wpmailsmtp.com/wp-content/uploads/2021/06/Download-WPForms-plugin.png)Once the zip file has finished downloading, open your site’s WordPress dashboard. In the left-hand menu bar, click on **Plugins** and then click **Add New**.

![Upload plugin in WordPress](https://wpmailsmtp.com/wp-content/uploads/2019/06/Upload-plugin-in-WordPress.jpg)Then, click on Choose File and navigate to the location where you downloaded the WP Mail SMTP zip file. Then double-click on it and press **Install Now**, followed by **Activate Plugin**.

![Activating WP Mail SMTP Pro](https://wpmailsmtp.com/wp-content/uploads/2021/12/activate-wp-mail-smtp-pro.png)This should launch the Setup Wizard automatically. If it didn’t launch, you can manually launch it by going to **WP Mail SMTP » Settings** and pressing the **Launch Setup Wizard** button.

![Launch Setup Wizard button](https://wpmailsmtp.com/wp-content/uploads/2021/07/launch-set-up-wizard-button.png)### 2. Connect to a Mailer Service

The Setup Wizard lets you choose a 3rd party mailer service to send your emails. So in this step, we’ll be configuring a proper email delivery service to replace the problematic default WordPress web host.

When you’re finished with this step, WP Mail SMTP will reconfigure the default `wp_mail()` function to use SMTP from now on to avoid email issues. To begin, click on the **Let’s Get Started** button.

![Start the WP Mail SMTP setup wizard to fix Elementor form not sending email](https://wpmailsmtp.com/wp-content/uploads/2021/02/wp-mail-smtp-setup-wizard.png)You’ll find a list of recommended mailers on the next screen. You can choose any mailing service from this list. If you’re just getting started, then one of the best options is to use the free trial of [SendLayer](https://sendlayer.com).

![Select your SMTP mailer](https://wpmailsmtp.com/wp-content/uploads/2021/06/SMTP-Email-Setup-Brevo.png)You can also learn more about [different transactional email providers](https://wpmailsmtp.com/transactional-email-providers/) to make a better decision. When you’ve decided on the mailer you want to use, click on the link below for the mailer you want to set up:

Mailers available in all versionsMailers in [WP Mail SMTP Pro](https://wpmailsmtp.com/pricing/)[SendLayer](https://wpmailsmtp.com/docs/how-to-set-up-the-sendlayer-mailer-in-wp-mail-smtp/)[Amazon SES](https://wpmailsmtp.com/docs/how-to-set-up-the-amazon-ses-mailer-in-wp-mail-smtp/)[SMTP.com](https://wpmailsmtp.com/docs/how-to-set-up-the-smtp-com-mailer-in-wp-mail-smtp/)[Microsoft 365 / Outlook.com](https://wpmailsmtp.com/docs/how-to-set-up-the-outlook-mailer-in-wp-mail-smtp/)[Brevo](https://wpmailsmtp.com/docs/how-to-set-up-the-sendinblue-mailer-in-wp-mail-smtp/) (formerly Sendinblue)[Zoho Mail](https://wpmailsmtp.com/docs/how-to-set-up-the-zoho-mailer-in-wp-mail-smtp/)[Google Workspace / Gmail](https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/) [Mailgun](https://wpmailsmtp.com/docs/how-to-set-up-the-mailgun-mailer-in-wp-mail-smtp/) [Postmark](https://wpmailsmtp.com/docs/how-to-set-up-the-postmark-mailer-in-wp-mail-smtp/) [SendGrid](https://wpmailsmtp.com/docs/how-to-set-up-the-sendgrid-mailer-in-wp-mail-smtp/) [SparkPost](https://wpmailsmtp.com/docs/how-to-set-up-the-sparkpost-mailer-in-wp-mail-smtp/) [Other SMTP](https://wpmailsmtp.com/docs/how-to-set-up-the-other-smtp-mailer-in-wp-mail-smtp/) Follow the instructions in the doc carefully and come back to this article to finalize your WP Mail SMTP setup.

Want to set up multiple mailers? You can do so in the [Additional Connections](https://wpmailsmtp.com/docs/configuring-additional-connections/) settings, then select a [Backup Connection](https://wpmailsmtp.com/docs/configuring-backup-connection/) and configure [Smart Routing](https://wpmailsmtp.com/docs/setting-up-smart-email-routing/).

### 3. Enable Detailed Email Logs Optional)

Once you’ve successfully configured and connected your mailer with WP Mail SMTP, the Setup Wizard will ask you to choose the email features you want to enable.

**Improved Email Deliverability** and **Email Error Tracking** are enabled by default and can’t be turned off, but I highly recommend turning on the **Detailed Email Logs**, too.

![Enabling email logs and email alerts in the WP Mail SMTP Setup Wizard](https://wpmailsmtp.com/wp-content/uploads/2022/10/setup-wizard-enable-features.png)When enabled, this tool keeps a log of all the emails your WordPress site has generated and sent. Plus, it keeps a record of a ton of useful data in **Complete Email Reports**, such as:

- Number of opens and clicks in your WordPress emails
- Number of attachments
- Email delivery status
- Date and subject of each email
- Resend or forward failed emails
- …and more

![Email log details](https://wpmailsmtp.com/wp-content/uploads/2021/10/open-and-clicked-email-tracking.png)The **Weekly Email Summary** feature is a very useful way of monitoring your email performance. When enabled, it will send you an email every week with a quick summary about:

- Total emails sent the past week
- Number of confirmed email deliveries
- Number of unconfirmed email deliveries
- Failed emails

With this summary, you can keep track of how well your wp\_mail function is working and check if there are any errors as they show up.

![Email Summary With Statistics in WP Mail SMTP Pro](https://wpmailsmtp.com/wp-content/uploads/2021/08/email-summary-pro-statistics.png)The **Instant Email Alerts** feature notifies you whenever an email fails to send to that you can quickly fix the problem. That way your users won’t miss out on important messages.

![An email alert notification](https://wpmailsmtp.com/wp-content/uploads/2022/07/example-email-alert.png)So, if you’d like to make sure everything is going well with your emails at all times, we recommend enabling these extra features to [get the most out of WP Mail SMTP](_wp_link_placeholder).

### 4. Perform an Email Test

After you have completed all of the above steps, the WP Mail SMTP Setup Wizard will send a test email to verify if everything has been configured correctly.

If there are no problems with your chosen configuration, the WP Mail SMTP setup wizard will display a success message.

![WP Mail SMTP test email success](https://wpmailsmtp.com/wp-content/uploads/2021/08/WP-Mail-SMTP-test-email-success-message.png "WP Mail SMTP Test Email Success")At this stage, you should wait until a few emails have been generated to ensure you don’t face the ‘could not instantiate mail function’ error again.

If you don’t want to wait, you can go to **WP Mail SMTP » Tools » Email Test** to send a few test emails from WP Mail SMTP.

![WP Mail SMTP email test](https://wpmailsmtp.com/wp-content/uploads/2023/07/Email-Test-tab-in-WP-Mail-SMTP.jpg "WP Mail SMTP Email Test")Here is a screenshot of what the test message could look like in your inbox, so you know what to expect. This ensures that your emails will now send successfully.

![Automatic test email from WP Mail SMTP](https://wpmailsmtp.com/wp-content/uploads/2021/07/wp-mail-smtp-automatic-test-email.png "Automatic Test Email From WP Mail SMTP")### 5. Resend Failed Emails Instantly

You can resend failed emails easily from the WP Mail SMTP email log. In order to do this, you’ll need to have turned on the **Store the content for all sent emails** option in the Setup Wizard.

If you didn’t do so, you can turn the setting on by going to **WP Mail SMTP » Settings » Email Log.** To resend an email, go to **WP Mail SMTP » Email Log** from your WordPress dashboard

![Open the email log in WP Mail SMTP](https://wpmailsmtp.com/wp-content/uploads/2021/07/email-log-wp-mail-smtp-30.png "Open the email log in WP Mail SMTP - WP Mail SMTP")You’ll see a list of all emails sent from your website. Any emails that failed will be marked with a red dot. Click on the **View Log** button for the email that has failed to deliver.

![failed email in WP Mail SMTP](https://wpmailsmtp.com/wp-content/uploads/2021/04/failed-email-in-WP-Mail-SMTP.png "failed email in WP Mail SMTP - WP Mail SMTP")And on the right-hand side, you’ll find the **Resend** button under the **Actions** tab. Edit the email address if you need to, then click the **YES** button to resend the email.

![email resend alert](https://wpmailsmtp.com/wp-content/uploads/2021/07/resend-email-confirmation.png "resend-email-confirmation - WP Mail SMTP")And that’s it! You’ve now fixed the `wp_mail()` function by reconfiguring it to use the much more reliable SMTP and even learned how to resend any failed emails.

### FAQs on Why wp\_mail Is Not Working (& How to Fix It)

The `wp_mail()` function not working is a popular topic of interest among our readers. Here are answers to some common queries 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 reason is the hosting server blocking PHP mail. Missing email authentication or plugin conflicts can also cause issues.

#### How do I test if wp\_mail is working properly?

Install WP Mail SMTP and use its test email tool. It shows if 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 using 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 it’s not set up with an SMTP, the server might 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](https://wpmailsmtp.com/send-email-with-attachments-wordpress/) from your WordPress forms or other plugins.

And if you’re having some trouble getting emails from your Elementor forms, here’s what to do [when Elementor contact forms don’t send emails](https://wpmailsmtp.com/elementor-form-not-sending-email/).

You might also want to improve your WordPress SEO. See our article on the [best WordPress SEO plugins](https://wpmailsmtp.com/best-wordpress-seo-plugins/) to boost your organic traffic and rankings.

[Fix Your WordPress Emails Now](https://wpmailsmtp.com/pricing/)

Ready to fix your emails? [Get started today](https://wpmailsmtp.com/pricing) 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.

If this article helped you out, please follow us on [Facebook](https://facebook.com/wpmailsmtp) and [Twitter](https://twitter.com/wpmailsmtp) for more WordPress tips and tutorials.

**Categories:** WordPress Tutorials

**Tags:** WordPress email deliverability, WP Mail SMTP, wp_mail

---

