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 configuration.
# 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 the emails. Normally, web hosting that supports PHP and WordPress will be configured to send email for your WordPress site. When you install WordPress or migrate WordPress to these web hosts, the sending of email should work without the need for user configuration. However, some web hosts disable the PHP mail function because it is easily exploitable by spammers and hackers.
Install 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 Post SMTP plugin for email testing. Follow the steps below.
- Install 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 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, Post SMTP plugin offers Email Log feature for free. So you can check the sending email status from there.
If your test is failing, the cause may come either from server configuration or your web host disabling the PHP mail function. You should contact your web host for further details.
# Contact form configuration
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 the visitors contact you via their phone.
If you never got the WordPress notification in your mailbox, but the contact form shows a successful message, the problem may be the form configuration.
To order to identify the cause, we will use the Post SMTP plugin that I mention 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 form.
- Next, navigate to Post SMTP>Email Log at the WordPress backend.
- Check the status of your message.
- If the status is “Sent“, that means WordPress is able to send the email out but your mail server didn’t deliver your email into your mailbox.
In my case, I use WPforms plugin. I got the “Sender prohibited by SPF” error. The reason that I got the “Sender prohibited by SPF” error is because of my form configuration.
Here are some of my form configuration in WPforms settings:
- Send to Email Address: email@example.com
- From Email: firstname.lastname@example.org
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 if you use the same email address for both settings.
To solve the issue, I changed the email address at Form Email setting from email@example.com to firstname.lastname@example.org. Using a domain-specific email address as the Form Email solves my issue. If your domain name is abc.com, you can enter email@example.com at the Form Email. The firstname.lastname@example.org 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.
And that’s it. I hope you can solve your WordPress email notification issue.