Fixing Contact Form 7’s “Failed to send your message” error

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 [email protected] or [email protected] 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.

Was this article helpful?

Keep In Touch


Wil is a dad, WordPress consultant, WordPress developer, business coach and mentor. He co-organizes the WordPress Sydney meetup group and has been on the organising committee for WordCamp Sydney since 2014. He speaks at many special events and contributes to the WordPress open source project. His likes are chillies, craft beer and electrogravitics.

12 thoughts on “Fixing Contact Form 7’s “Failed to send your message” error”

  1. 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.

  2. fhjdsakfjhdskjfh

    my problem was solved very easily by chainging the from and to addresses to my email.

  3. 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 🙂

  4. Great post! Thank you for sharing your insight. Saved me a ton of time researching for a solution.

  5. 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

  6. Gr8 Post..Thank you for sharing your insight. Saved me a ton of time researching for a solution.


  7. 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.

Comments are closed.