Tech Tips on Computers, Internet, Blogging, Web Development, Social Media, Android and more

Full width home advertisement

Post Page Advertisement [Top]

How To Resolve WordPress Unable to Send Messages Mails from Contact Form
Just recently, I received a complaint for a WordPress website I helped built, that it was no longer sending messages from the website's contact form. The owner of the website incidentally was curious why messages had stopped coming to them, and they did test it out and confirmed there was an error displayed on the WordPress website when trying to send a message using the WordPress Contact Form. So, I also tested and confirmed the error, which says:
The error on the WordPress site was:
There was an error trying to send your message. Please try again.
unable to send emails from wordpress website error

If you are facing a similar issue, check out this short video to resolve the issue or read the steps below:

How to resolve WordPress not able to send emails from Contact Forms?



Things to check if WordPress is not sending out emails from the site or from Contact Forms:

  • Confirm the WordPress website email settings or WordPress Contact Form settings are correct
  • If the WordPress website is configured to use the email from your domain, say, info@yourdomain.com , then login to the Control Panel provided by the host and check the following:
    • For example on CPANEL: Login to CPanel > Email > Open Email Accounts. 
    • Open WebMail for the particular email address used by the WordPress website
    • From another email such as Gmail, try to send an email to "info@yourdomain.com" and see if the email is received by "info@yourdomain.com".
    • Also try sending out an email from "info@yourdomain.com" to the Gmail address and see if the email is sent.
    • If the email is sent and received, there is no problem with your email account. If no, then you need to check with your host regarding the issue.

How To Resolve WordPress Unable to Send Messages/Mails from Contact Form? 

From the check above, if it is confirmed that there is no problem in sending or receiving emails, then we can proceed further. 

Cause: Why are emails not getting sent from WordPress?
From the issue I worked on, I got to know from my host that the default PHP "Mail()" function was disabled on the server. The reply on my query to the host is given below:
We would like to update you that Mail function is disabled on the server because it is a vulnerable function and can be used by spammers to send
unauthenticated emails.Using the php mail function means that you are sending emails without even login into your email account.

To know more about why we have disabled mail function, please follow the link as given here : https://lwn.net/Articles/8653/

There is a workaround for that. You can use smtp authentication in your mailing scripts to send emails. So disabling mail function should not cause problems.
That is why emails are not sent from the website as emails are sent without SMTP authentication, which is blocked by the server.

Solution: Install WordPress Mail SMTP plugin
While we can write simple PHP script for the SMTP authentication but that may not be required as there are WordPress Plugins for the same. Why reinvent the wheel, hmm?
  • Login to WordPress as admin
  • Click on "PLUGINS" > "ADD NEW" menu on the left sidebar
  • Search for "WordPress Mail SMTP" plugin
  • Install and activate the plugin
  • Go to the "WordPress Mail SMTP" Settings page from the plugins page. Configure the "WordPress SMTP Plugin" settings.
    • Specify the from name and email address for outgoing email. ( The plugin should pickup the email configured for the website. Just confirm if it is correct.)
    • Choose to send mail by SMTP or PHP's mail() function.
      Choose "Send all WordPress emails via SMTP" (Required)
    • Specify an SMTP host (defaults to localhost). (localhost also works. But if possible, enter the server host name)
    • Specify an SMTP port (defaults to 25).(Use 465 for SSL)
    • Choose SSL / TLS encryption (not the same as STARTTLS).
    • Choose to use SMTP authentication or not (defaults to not).
    • Specify an SMTP username and password. (the username and password for the email address configured with your domain)
Where to get the SMTP configuration details for your domain email?
If you are not sure where to get the above SMTP details required, you can get the details from the email address setup on your domain Control Panel.
  • For example on CPANEL: Login to CPanel > Email > Open Email Accounts
  • Corresponding to the particular email address in use for the WordPress website, click on "Setup Email Client". A page is displayed showing the SMTP configuration details. Yes, this page is about configuring Email Clients such as Outlook, Thunderbird or Email on your phone, but don't be confused. The requirement is the same.
  • Get those details and put it in the WordPress Mail SMTP plugin configuration page.
cpanel smtp manual setting details

  • Finish configuring "WordPress Mail SMTP" and click "Save Changes"
  • On the same page, enter another email address to test.
  • After sending test email, if the log shows "The result was: Boolean (true)", it means the email was sent successfully.
  • You can now go back to the WordPress Contact Form and test it.
Download WordPress Mail SMTP Plugin

No comments:

Post a Comment

Bottom Ad [Post Page]