We came across this issue on a recent client website. This blog will show you how to fix the issue.
The website was designed as a bespoke theme running on top of WordPress 3.0.5, although the WordPress version number is not relevant to the fix.
A couple of forms on the site were used to collect enquiries and bookings, choosing Contact Form 7 to implement these (version 2.4.3 at the time of writing).
Our development environment is the standard WAMP/LAMP model (Windows/Linux, Apache, MySQL and PHP) where everything was tested and working fine.
The problem occurred when uploading the site to the hosting server which was running IIS rather than Apache -although, IIS is not the direct cause of this issue.
When submitting a Contact Form 7 form we received the “Failed to send your message. Please try later or contact administrator by other way.” error message.
In most of the hosting options we’ve come across, we have found that Apache and IIS are configured to use the Sendmail or equivalent program.
Any call to the phpmail() function, which is how WordPress sends its mail, is determined by how the php.ini file is set up with the webserver.
The “Failed to send your error message” error arises because the web server, Apache or IIS, has not been configured to send out mail.
So we needed an alternative way to send out mail (SMTP) from WordPress.
A quick search of the plugins revealed a nice little plugin called WP Mail SMTP. It does what it says on the tin!
You’ll need to download and activate this plugin, then set it up with the relevant email address, that you use along with the outgoing mail server name, username and password.
Configure this plugin the way you would set up a new account under Outlook.
The plugin even allows you to send a test mail so you’ll know when all the details have been entered correctly.
Once your WordPress installation can send out SMTP mail you’ll need to alter the Contact Form 7 form templates slightly to accommodate the new method of sending mails.
In the From: field, enter the same email address that you have used to configure the WP Mail SMTP plugin.
This sets the senders email address on the outgoing email message. You may have it set up with an info@ or webmaster@ address.
So that you can easily reply to customers submitting the forms, you need to add the following line into the Additional Headers field.
Reply-To: [your-email]
Making sure to replace the field name ‘your-email’ with whatever field name you are using to gather the email address on the form.
This sets the reply address on the outgoing email message. When you click on reply in your inbox your message will be sent to the email address that was entered in the form and not the one used to send out the email which you configured in the WP Mail SMTP plugin.
Hit the save button on the form, refresh your front-end contact form and try sending again.
You should now get the “Your message was sent successfully. Thanks.” green bordered message.
Note: It may take a little longer for the email to arrive in your inbox as it is being routed through an additional step. Give it a minute or so then check your inbox.
HTML option Note: If you have the “Use HTML content-type” checked, remember to remove the < and > characters from the default ‘<[your-email]>’ line that’s created otherwise it will look like the email address is missing from your incoming HTML messages. The email client will try to render the address as an HTML tag because it’s included within the < and >.
Google Analytics Event Tracking: You may also like to set up Google Analytics event tracking for your forms.
Let us know if this has helped you.
12 Responses
Thank you. There are a lot of these out there that don’t really intend
to answer the question. The SMTP plug-in was exactly the right answer.
Thanks a lot..
my problem was solved very easily by chainging the from and to addresses to my email.
I am trying to test CF7 on local dev using InstantWP. It won’t send. Any ideas or starting points? Thanks in advance!
Thank you kindly for this!
I just changed hosts, moved all my sites over and this happened. I tried reinstaling CF7 but to no avail. This worked instantly! Thank you 🙂
Great post! Thank you for sharing your insight. Saved me a ton of time researching for a solution.
Thank you! This worked. 🙂
Hi will i am having the Same issue on iis i have tried to change email but wordpress not even send me a confirmation email what should i do
Gr8 Post..Thank you for sharing your insight. Saved me a ton of time researching for a solution.
Cheers..
Hi Wil, great post mate, saved me so much time mucking about with CF7, which just stopped sending emails after working faultlessly for over a year. Well explained and I had my contact emails up and running again in 10 minutes. Many thanx.
saved the day … worked like a charm
Thanks a lot..