How to fix WordPress not sending Emails issue
Home » BLOG » WordPress » How to fix WordPress not sending Emails issue

How to fix WordPress not sending Emails issue

category:  WordPress

Issues with email sending are some of the most common questions that I have from my clients. Often, the clients are not seeing any of the expected WordPress notifications. This is usually due to problems with their server configuration or their contact form setting.

Server configuration

WordPress is built in PHP which is one of the most popular server script languages. WordPress uses the PHP mail function to send out emails. Normally, web hosting that supports PHP and WordPress will be configured to send an email to your WordPress site. When you install WordPress or migrate WordPress to these web hosts, the sending of the email should work without the need for configuration. However, some web hosts disable the PHP mail function because it is easily exploitable by spammers and hackers.

Install the Post SMTP plugin for email testing

In order to identify if this is the case, first, you want to know if the email is actually being sent out from your WordPress or not. We will use the Post SMTP plugin for email testing.

Follow the steps below.

  • Install the Post SMTP plugin on your WordPress site and activate the plugin
  • Navigate to Post SMTP>Post SMTP
  • Then click on Send a Test Email
  • Enter the Recipient Email Address and click Next
  • The Post SMTP plugin will try to send an email out.
  • If the email is sent, you will see the successful message on the screen and you will receive the test email from the Post SMTP plugin in your mailbox.
  • If the email is NOT sent, you will see the failure message on the screen. You will see the status message telling you what is the problem.
  • Additionally, the Post SMTP plugin offers an Email Log feature for free. So you can check the sending email status from there.

Test Fails

If your sending email test fails, the cause likely comes either from server configuration or your web host disabling the PHP mail function. You should contact your web host for further details.

Contact form setting

The Contact Form is one of the MUSTS on a website. The visitors can easily contact you via the form rather than having to copy and paste your contact email to their mail application. This is an essential convenience when visitors contact you via their phone.

If you never got the WordPress notification in your mailbox (a copy of an entry from the contact form), but the contact form shows a successful message, the problem may be the form set. You see the successful message on the screen which means your server can send out the mail (the PHP mail function receives the success status from the server).

In order to identify the cause, we will use the Post SMTP plugin that I mentioned above. Make sure the plugin is activated.

  • Now, enter the message on the contact form on your WordPress site and hit the send button for submitting the contact form.
  • Next, navigate to Post SMTP>Email Log at the WordPress backend.
  • Check the status of your message from the email log page
  • If the status is “Sent“, that means the WordPress site is able to send the email out but the received mail server didn’t deliver the email into the mailbox.

In my case, I use the WPforms plugin. I got the “Sender prohibited by SPF” error. The reason that I got the “Sender prohibited by SPF” error is that my form setting is incorrect.


Here is my form setting in the WPform plugin

  • Send to Email Address:
  • From Email:

As you see I use the same email address for both settings. Some email providers will flag the message as spam or block it from being delivered because the spam filters try to detect that an email is really coming from the location that it claims to be from.


To solve the issue, I changed the email address from the From Email setting from to Using a domain-specific email address at the From Email solves the issue.

For example, if your domain name is, you will enter at the Form Email. The doesn’t need to be created since we never use this email to receive any emails. This solution can apply to other contact form plugins such as Contact Form 7.

What if, you want to use your specific email at “From Email”

For the solution above, the received email header will show the in the From field because you set the From Email as in the Wpform setting. If you want to use other emails instead of, you can send the email via SMTP instead of using the PHP mail function which is a default mail function that WordPress uses (PHPMailer).

What is SMTP?

SMTP stands for Simple Mail Transfer Protocol. It is an Internet standard communication protocol for email transmission. SMTP uses proper authentication for your domain. Because of the authentication, spam filters will give the green light for your email and this email will go to the inbox. PHP mail function doesn’t have SMTP authentication.

Popular SMTP sending email service

You can sign up for those SMTP services and add the SMTP configuration to the contact form plugin. So that the contact form will use SMTP authentication for sending the email for your form.

Avoid being flagged as spam or blocked for receiving

The SMTP authentication will help your email avoid being flagged as spam or blocked for receiving.

What if, you want to configure SMTP into the WordPress site without a plugin

If you are a developer and create your own contact form, you can use PHPmailer and your SMTP configuration. You can add the code to the functions.php or your own custom plugin.


WordPress comes with a PHPMailer class. It is available at

Side note, if you use the contact form plugin, you don’t need to continue with the code below. Because the contact form plugin allows you to configure the SMTP via its plugin.

Here is a code example.

  • Create the constant variables in wp-config.php. In the future, you can change the SMTP configuration from this wp-config.php.
define( 'SMTP_HOST', '' );  
define( 'SMTP_AUTH', true );
define( 'SMTP_PORT', '465' );
define( 'SMTP_SECURE', 'ssl' );
define( 'SMTP_USERNAME', '' );  
define( 'SMTP_PASSWORD', 'password' );          
define( 'SMTP_FROM',     '' );  
define( 'SMTP_FROMNAME', 'Apple Rinquest' );   
  • In functions.php or your own custom plugin, add this code below. We use the “phpmailer_init” hook.
add_action( 'phpmailer_init', 'ar_smtp_email' );
function ar_smtp_email( $phpmailer ) {
    $phpmailer->Host       = SMTP_HOST;
    $phpmailer->SMTPAuth   = SMTP_AUTH;
    $phpmailer->Port       = SMTP_PORT;
    $phpmailer->SMTPSecure = SMTP_SECURE;
    $phpmailer->Username   = SMTP_USERNAME;
    $phpmailer->Password   = SMTP_PASSWORD;
    $phpmailer->From       = SMTP_FROM;
    $phpmailer->FromName   = SMTP_FROMNAME;

Now, your WordPress site is configured to use your SMTP.

  • So you can call wp_mail() to send the email by using your SMTP authentication.
wp_mail("", "Test Subject", "Test Message");

Wrap up

WordPress won’t send emails out, which is one of the commonly known issues. To perform the troubleshoot, first, check whether the server configuration is correct or not by installing and activating the Post-SMTP plugin. The Post SMTP plugin will log the sent email. If none of the emails are sent out, the fail status will show on the email log. Then you need to check the server configuration. If the emails are sent out, the successful status will show on the email log. Meaning your server configuration is correct. But you don’t get the email from the form even though you see the successful message from the form, meaning your form setting is wrong.

For the form setting, you should check the “From Email” field or add the SMTP authentication. Mostly these two methods will work.

And that’s it. I hope my post is helpful and saves you time. Please consider buying me a coffee. It will make my day.