[Solved] Why wp_mail is not working (and how to fix it) (2023)

Do you want to know why wp_mail is not working and fix it?

problems with thewp_mail()Functions are very common for WordPress users. And if it doesn't work properly, your WordPress emails won't send (which is a big problem).

But it is very easy to fix.wp_mail(). In this post, we will show you the simplest solution.wp_mail()Problems so that your e-mails always reach your recipients without errors.

Repair your WordPress emails now

What is wp_mail?

wp_mail()is a PHPMailer function that generates and sends your WordPress emails. By default, almost all WordPress plugins are usedwp_mail()to send emails. Butwp_mail()The function is not very reliable. So if something goes wrong, you'll find email delivery problems all over your site.

Why isn't wp_mail working?

There are some common reasons for thiswp_mail()it may not work for you:

  • PHP mail is disabled by your web server:The PHP mailer is an insecure method of sending email and can be exploited by hackers and spammers. For this reason, many web hosts disable the PHP mailer on their servers. Fromwp_mail()depends on PHP to send email, it won't work if PHP is disabled on your web server.
  • Your emails will be marked as spam:A big problem withwp_mail()The function is that it was only designed for your comfort. Therefore, the emails generated by this feature do not contain any authentication information that shows that the email is from a legitimate source. As a result, your emails are considered spam and never reach your recipient's inbox.
  • Your website runs on localhost:If your site is still under development, you can't send email with it.wp_mail(). That is becausewp_mail()does not support localhost. Instead, you need an alternate email delivery method like SMTP to reliably generate and send email.

The good thing is that there is a single solution for all these problems when wp_mail is not working. And the solution is to use the WP Mail SMTP plugin.

How to fix wp_mail easily

The easiest way to fix all problems with thewp_mail()The function is to reconfigure it to use SMTP instead of relying on PHP. The easiest way to achieve this is to use WP Mail SMTP.

[Solved] Why wp_mail is not working (and how to fix it) (1)

This plugin configures your WordPress site to use SMTP, which is good practice for sending your emails as it adds proper authentication to your messages.

Also, this plugin sends your emails through a dedicated third-party email service provider instead of your default web host. This ensures that your email can always be delivered.

(Video) How to Fix WordPress Not Sending Email Issue | SMTP Setup Tutorial

Furthermore, WP Mail SMTP offers a number of additional features such as:

  • bug tracking
  • Weekly Email Summary
  • Detailed email logs
  • … and more

In this article

  • 1. Installation of WP Mail SMTP
  • 2. Connection of the mail service to WP Mail SMTP
  • 3. Enable detailed email logs and weekly email digest (optional)

1. Installation of WP Mail SMTP

First you need a paymentWP Mail SMTP-Abonnementor thefree version. You can fix issues with wp_mail(), but the free version doesn't come with advanced features like weekly email digests and email logs.

Once you have purchased your plan, go to your WP Mail SMTP panel and navigate todownloadsTab Scroll down to click theDescargar WP Mail SMTPGusto.

[Solved] Why wp_mail is not working (and how to fix it) (2)

Once the ZIP file has been downloaded, open your website's WordPress dashboard. Click on the menu bar on the leftComplementsand then clickadd new.

[Solved] Why wp_mail is not working (and how to fix it) (3)

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 pressInstall Now.

[Solved] Why wp_mail is not working (and how to fix it) (4)

After installation, clickActivate Plugin.

(Video) WP Mail SMTP - Wordpress not Sending Emails ( latest 2021 )

[Solved] Why wp_mail is not working (and how to fix it) (5)

This should start the setup wizard automatically. If it has not started, you can start it manually by going toWP Mail SMTP » Settingsand pressing theStart the setup wizardGusto.

[Solved] Why wp_mail is not working (and how to fix it) (6)

2. Connection of the mail service to WP Mail SMTP

The setup wizard allows you to choose a third-party mail service to send your email. So, in this step, we will set up a proper email delivery service to replace the problematic WordPress default web host.

When you are done with this step, WP Mail SMTP will reconfigure the default valuewp_mail()Feature to use SMTP from now on to avoid problems with email.

First click on theLet us beginButton on the first screen of the configuration wizard.

[Solved] Why wp_mail is not working (and how to fix it) (7)

On the next screen you will find a list of recommended emails.

[Solved] Why wp_mail is not working (and how to fix it) (8)

You can select any mail service from this list. If you are just starting out, one of the best options is the free trial ofsend shift. You can also learn more about itvarious transactional email providersto make a better decision.

Once you've decided which email you want to use, click the link below for the email you'd like to set up:

(Video) How to Fix WordPress Not Sending Emails Issue - Gmail SMTP Setup Tutorial

Envelopes available in all versionsrein of mailWP SMTP Mail Pro
send shiftAmazon-SES
SMTP.comMicrosoft 365 / Outlook.com
send blueZohoMail
Google Workspace/Gmail
mail gun
Other SMTP

Follow the instructions in the document carefully and come back to this article to complete your WP Mail SMTP setup.

Do you want to configure several emails? you can do that inadditional connectionsSettings, and then select abackup connectionand configuresmart routing.

3. Enable detailed email logs and weekly email digest (optional)

Once you have successfully configured your email and connected it to WP Mail SMTP, the setup wizard will ask you to select the email features you want to enable.

Improved email deliverabilityYEmail Bug Trackingthey are enabled by default and cannot be disabled.

[Solved] Why wp_mail is not working (and how to fix it) (9)

We highly recommend turning this onDetailed email logs, to. When enabled, this tool keeps track of all the emails your WordPress site has generated and sent. In addition, it stores a large amount of useful data.Full reports by emailAs:

  • Number of opens and clicks on your WordPress emails
  • number of attachments
  • Email delivery status
  • Date and subject of each email
  • Resend or resend broken emails
  • …and more

[Solved] Why wp_mail is not working (and how to fix it) (10)

HeWeekly Email SummaryThe feature is a very useful way to monitor your email performance. If this option is activated, you will receive an email every week with a brief summary about:

  • Total number of emails sent in the last 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.

[Solved] Why wp_mail is not working (and how to fix it) (11)

HeInstant email notificationsThe feature notifies you when an email cannot be sent so you can quickly fix the problem. That way, your users won't miss any important messages.

(Video) Wordpress: Wp_mail() function not working in Windows and MAC OS (3 Solutions!!)

[Solved] Why wp_mail is not working (and how to fix it) (12)

So if you want to make sure your emails are always in order, we recommend enabling these additional features to get the most out of WP Mail SMTP.

When you are done with all these steps, the WP Mail SMTP Setup Wizard will send a test email to make sure everything is set up correctly. If there are no problems with your setup, a success message will appear.

[Solved] Why wp_mail is not working (and how to fix it) (13)

And that is! you already fixed itwp_mail()reconfiguring it to use the much more reliable SMTP.

Then send emails with attachments

Would you like to send emails with WordPress attachments? Consult our guideSending WordPress Emails With Attachmentsfrom your WordPress forms or other plugins.

And if you're having trouble getting emails from your Elementor forms, here's how to do it.when Elementor contact forms do not send emails.

You may also want to improve your WordPress SEO. See our article on theBest WordPress SEO Pluginsto increase your organic traffic and rankings.

Repair your WordPress emails now

Are you ready to fix your email? Get started today with the best WordPress SMTP plugin.WP Mail SMTP-Eliteincludes complete White Glove setup and offers a 14-day money-back guarantee.

If this article helped you, please continue to follow us.FacebookYGorefor more WordPress tips and tutorials.

(Video) How to Fix the WordPress Not Sending Email Issue


Why is wp_mail not working on server? ›

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.

Why is my WP SMTP mail not working? ›

The SMTP error indicates that your web server could not connect to the SMTP server probably because of your Firewall rules. When you get a chance, could you please contact your web hosting support and ask them to look into the issue. You can provide them with the SMTP settings you're using and the error log you shared.

Why is my WordPress admin not sending email? ›

There's a good chance that you're experiencing the WordPress not sending email issue because either your underlying SMTP server isn't configured properly, you're picking up a poor reputation from senders on a shared server environment, or mail servers are blocking your mail for some other reason.

How to enable wp_mail in WordPress? ›

The WP Mail SMTP plugin is installed automatically if you installed WordPress using the DreamHost WordPress installer in the panel as of June 2021. You must now activate it in your dashboard. Navigate to the Plugins > Installed Plugins page. Under WP Mail SMTP, click the Activate link.

How to check if wp_mail is working? ›

php, then browse to it directly in your browser to fire the wp_mail function (http://yourdomain.com/mailtest.php). You will get a result on screen, and if all is functioning, you will receive a test message in your inbox. If you get an error message or you don't receive the email, there is an issue with wp_mail.

Does wp_mail use SMTP? ›

This is where the WP Mail SMTP plugin comes in. It allows you to send WordPress emails via SMTP by entering your SMTP credentials. WP Mail SMTP is the most popular SMTP solution for WordPress, currently used by over 2 million websites. It's maintained by the same team as WPForms.

How do I fix SMTP on WordPress? ›

1. Install the WP Mail SMTP Plugin
  1. Next, switch to your website and log in to the WordPress dashboard. ...
  2. Upload the plugin zip file and click Install Now.
  3. Once the plugin is installed, be sure to activate it. ...
  4. On the next screen, you'll see a list of available mailers that you can configure in WP Mail SMTP.
Jan 10, 2023

How do I fix my email SMTP server? ›

How to fix issues with sending email (SMTP)
  1. Open the settings for your email in the application or device you are using.
  2. Locate the outgoing SMTP server and its settings.
  3. Check the current outgoing port and change it to 26 or 587.
  4. Make sure any username and password fields are filled in if shown.
  5. Save changes and test.

How do I fix Cannot send mail? ›

And here's a checklist to understand why you're unable to send emails and troubleshoot any major problem:
  1. Check your internet connection. Yup. ...
  2. Check your SMTP server details. ...
  3. Verify all usernames and passwords. ...
  4. Check your SMTP server connection. ...
  5. Change your SMTP port. ...
  6. Control your antivirus or firewall settings.

What is the difference between wp_mail and mail? ›

What is the difference between a wp_mail() & PHP's mail() wp_mail is a function defined in wordpress that uses the PHPMailer class - http://sourceforge.net/projects/phpmailer/ so you can use wp_mail only if you use Wordpress. The PHP mail function is low level and you have to do all the work by yourself (eg.

Why is my WordPress contact form not working? ›

You need to make sure that you've set a valid email address in the widget's settings. Check your browser's error console for Javascript errors, and fix them if you have any. If you are an Elfsight form widget user and have a WordPress version of the widget, then check that your server supports mail function.

How to setup SMTP for WordPress localhost? ›

How to Send WordPress Emails on Localhost With SMTP
  1. Install WP Mail SMTP.
  2. Select an SMTP Mailer in the Setup Wizard.
  3. Add a Domain to Sendinblue.
  4. Get the Sendinblue API Key.
  5. Complete WP Mail SMTP Configuration.
  6. Send a Test Email From WordPress on Localhost.
  7. Disable WordPress Email Notifications on Localhost (Optional)
Nov 3, 2022

How do I fix WordPress media library not loading? ›

Go to Plugins > Installed Plugins in your WordPress backend. Now deactivate all plugins that are still active. Take a look at the Media Library in your WordPress to see if it works again. If it works, reactivate a plugin and check again if the media library works again.


1. WP Mail SMTP | WordPress Not Sending Email Issue | #fix
(Soft Learners)
2. Wordpress: wp_mail() is not working in localhost
(Roel Van de Paar)
3. WordPress Emails not Sending? SMTP Setup (Free Method)
4. Wordpress: WordPress wp_mail function not working, returns false
(Roel Van de Paar)
5. How to Set Up WP Mail SMTP with Gmail (Fix Failed Emails For Good!)
(WPForms - WordPress Forms Plugin)
6. WP Mail SMTP v3.7.0 Update - Introducing Backup Connections & Email Routing
(WPForms - WordPress Forms Plugin)
Top Articles
Latest Posts
Article information

Author: Kerri Lueilwitz

Last Updated: 23/05/2023

Views: 6405

Rating: 4.7 / 5 (67 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Kerri Lueilwitz

Birthday: 1992-10-31

Address: Suite 878 3699 Chantelle Roads, Colebury, NC 68599

Phone: +6111989609516

Job: Chief Farming Manager

Hobby: Mycology, Stone skipping, Dowsing, Whittling, Taxidermy, Sand art, Roller skating

Introduction: My name is Kerri Lueilwitz, I am a courageous, gentle, quaint, thankful, outstanding, brave, vast person who loves writing and wants to share my knowledge and understanding with you.