Asked by Jrprajapati on 08 Jan 2019 1501 Views
Jiwan on 08 Jan 2019
Over 5 million + websites built on wordpress have installed Contact Form 7 for messaging purpose because of its reliability and convenience to use. But lately, a huge number of people appear to complain about it not functioning well. In some cases, people say that the form appears to work properly on front end and displays the success message too while the message never reaches the destination mailbox, while in other cases, the error message appears though everything seems to have been done correctly as per the documentation. Let's see, how we can fix contact form 7 not sending email in wordpress.
Basically the problem lies on the basic setup of the plugin which most of the people seem to leave as default. The form data appears to be sent directly from the users' address by default settings which makes it much easier to send a automated reply back.
Though it was totally allowed in the past, most of the hosting services these days assume this procedure as a form of spoofing as the true source of email is being hidden. So, it's actually not the plugin itself but the security policies of the hosting companies that is creating problem.
The solution is simple though as you only need to setup a valid domain email account that exists on the server as the sender email address. And, on the Additional Headers field, add the sender's email address to direct the reply mail to the sender instead of the domain email account.
Here's the basic setup example.
The problem will be solved in most of the cases unless you are sending the email to other mailing services rather than the one your hosting service provides. In other cases, you'll need to authenticate your website to connect to those mailing services using WP Mail SMTP plugin which is explained below. In case of gmail, you'll also need to allow connection to less secure apps from your gmail user account settings.
If your mail function is still not working, you need to use a plugin named WP Email SMTP that allows you to authenticate your hosting email accounts to be connected to your website which seems to be mandatory these days in case of most of the hosting services.
Go to your Cpanel » Email Accounts and create an email account related to your domain like email@example.com. If you already have one, you can skip this step.
One your domain email account is created, go to the mailing account lisitings and search for Set Up Mail Client and click on it.
The configuration options will appear on the screen. Copy the Outgoing Server and SMTP Port details for the mail under Secured SSL/TSL Settings.
Now, go to Wordpress Dashboard » Plugins » Add New and search for WP Mail SMTP by WPForms. Install and activate it.
Go to Wordpress Dashboard » Settings » WP Mail SMTP and fill up the details as required.
From Email: Enter the email address you want to use to send mails.
From Name: Enter the default name you want to see on thefrom field on the incoming emails.
Mailer: Select Other SMTP in case you are not using gmail, mailgun or sendgrid.
SMTP Host: For gmail, mailgun or sendgrid, you can find the SMTP Host and Port details on the WP Mail SMTP plugin's documentation.In case you are using domain email account, you get it from the mail configuration settings in cpanel.
Encryption: Make sure that you select TLS only if you have a TLS certificate, else, you should select SSL as the encryption type.
SMTP Port: Similar to SMTP Host, you can see it on your mail configuration settings.
Authentication: Turn authentication on and enter your domain email address and password.
Save the settings and use Test Email option on top to send a test mail to your mailing address that you defined on the form's To field.
That's all you need to do to make the wordpress contact form 7 plugin work successfully in your website. Enjoy!!!