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. From
wp_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 with
wp_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.
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.
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.
Once the ZIP file has been downloaded, open your website's WordPress dashboard. Click on the menu bar on the leftComplementsand then clickadd 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 pressInstall Now.
After installation, clickActivate Plugin.
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.
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.
On the next screen you will find a list of recommended emails.
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:
Envelopes available in all versions | rein of mailWP SMTP Mail Pro |
---|---|
send shift | Amazon-SES |
SMTP.com | Microsoft 365 / Outlook.com |
send blue | ZohoMail |
Google Workspace/Gmail | |
mail gun | |
Stamp | |
SendGrid | |
SparkPost | |
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.
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
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.
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.
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.
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.
FAQs
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? ›- Next, switch to your website and log in to the WordPress dashboard. ...
- Upload the plugin zip file and click Install Now.
- Once the plugin is installed, be sure to activate it. ...
- On the next screen, you'll see a list of available mailers that you can configure in WP Mail SMTP.
- Open the settings for your email in the application or device you are using.
- Locate the outgoing SMTP server and its settings.
- Check the current outgoing port and change it to 26 or 587.
- Make sure any username and password fields are filled in if shown.
- Save changes and test.
- Check your internet connection. Yup. ...
- Check your SMTP server details. ...
- Verify all usernames and passwords. ...
- Check your SMTP server connection. ...
- Change your SMTP port. ...
- Control your antivirus or firewall settings.
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? ›- Install WP Mail SMTP.
- Select an SMTP Mailer in the Setup Wizard.
- Add a Domain to Sendinblue.
- Get the Sendinblue API Key.
- Complete WP Mail SMTP Configuration.
- Send a Test Email From WordPress on Localhost.
- Disable WordPress Email Notifications on Localhost (Optional)
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.