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.
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.
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 dedicated third-party email service providers 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
To set up WP Mail SMTP on your site, follow the step-by-step instructions below:
- Installing WP Mail SMTP
- Connecting Mailer Service with WP Mail SMTP
- Enable Weekly Email Summary and Logs (Optional)
1. Installing WP Mail SMTP
To start with, you’ll need a paid WP Mail SMTP subscription or the free version. You can get either to fix wp_mail() issues but the free version doesn’t include advanced features like weekly 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.
Once the zip file has finished downloading, open your site’s WordPress dashboard. On the left-hand menu bar, click on Plugins and then click Add New.
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.
After installing, click visit the Plugins screen by clicking on Plugins on the left-hand menu bar of your WordPress dashboard. Find WP Mail SMTP in your list of plugins and click on Activate.
This should launch the Setup Wizard automatically. If it didn’t launch, you can manually launch it by pressing the Launch Setup Wizard button under WP Mail SMTP settings window.
2. Connecting Mailer Service with WP Mail SMTP
The setup wizard lets you choose a third-party mailer service. 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 on the first screen of the Setup Wizard.
You’ll find a list of recommended mailers on the next screen.
You can choose any mailing service from this list. If you’re a small website, then one of the best options is to use the free plan of Sendinblue. You can also learn more about different 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 versions||Mailers in WP Mail SMTP Pro|
|Sendinblue||Microsoft 365 / Outlook.com|
|Google Workspace / Gmail||Zoho Mail|
Follow the instructions in the doc carefully and come back to this article to finalize your WP Mail SMTP setup.
3. Enable Weekly Email Summary and 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.
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.
Another great WP Mail SMTP feature is the Detailed Email Logs. 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 like:
- Number of opens and clicks in your WordPress emails
- Number of attachments
- Send status
- Date and subject of each email
- Resend or forward failed emails
- …and more
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.
When you’re done with all these steps, WP Mail SMTP Setup Wizard will send a test email to ensure everything is properly set up. If there are no issues with your setup, it will display a success message.
And that’s it! You’ve now fixed the
wp_mail() function by reconfiguring it to use the much more reliable SMTP.
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 WordPress forms or other plugins.
You might also want to improve your WordPress SEO. See our article on the best WordPress SEO plugins to boost your organic traffic and rankings.
Ready to fix your emails? Get started today with the best WordPress SMTP plugin. WP Mail SMTP Elite includes full White Glove Setup and offers a 14-day money-back guarantee.