Fixing woocommerce error

How to fix Contact form 7 there was an error trying to send your message. Please try again later

Pinterest LinkedIn Tumblr

When working with Contact form 7 on a fresh WordPress Woocommerce store or after moving your website to another hosting provider, you may see the error in

  • Contact form 7 There was an error trying to send your message. Please try again later

or

  • Failed to send your message. Please try later or contact the administrator by another method

The error stops you from receiving user’s message submitted via contact form, this is critically bad as your Woocommerce store will miss order or request from customers.

The error message may appear in Red border or Orange Border and each type of error has different fixes

In this tutorial, you will understand the cause of the error and learn how to completely fix it.

Cause of the issue

Red border error

If you see the error There was an error trying to send your message. Please try again later in Red border as below

=> This means your server/hosting failed to send email. There are various reasons for this failure.

  1. No php mail() function installed on your server and wordpress failed to send email using wp_mail()
  2. No smtp wordpress plugin installed
  3. Outdated php/wordpress version

Orange border error

In case the error messages There was an error trying to send your message. Please try again later showed in orange border

error message 2

=> this mean there was validation error (the form submission is under suspicion of spam)

Contactform 7 use several different spam protection modules such as Akismet, reCAPTCHA, and Comment Blacklist as protection modules to protect you from spammers. The message was blocked by one of those module, to find out exactly which module blocked the message you can install Flamingo plugin.

spam log
In this example, reCAPTCHA score is lower than the threshold => Message was filtered as spam

Note: Flamingo is a very helpful plugin, it works as an address book for your contact form 7

Solution

Depend on type of error, we have a corresponding fix

Solution for Red border error message

1) Install and enable php mail() function

Today, you will notice that many hosting provider have blocked mail() function to protect their server from spam or hacking.

You can check if mail() function is block by making a php file with the following code snipet:

<?php
if ( function_exists( 'mail' ) )
{
    echo 'mail() funcion is enabled';
}
else
{
    echo 'mail() was disabled, please contact hosting provider to enable';
}
?>

Name this file as checkmail.php and upload it to root folder of your website, and open this file with the url: youwebsite.com/checkmail.php. The results will be like this

mail is enabled
mail() is enabled
mail is disabled
mail is disabled

In this case, first, you will have to contact your hosting provider to see if php mail() function is disabled on your hosting/server.

If php mail() is disabled from server side, ask the support staff to enable it.

If php mail() is not disabled and you are using a VPS/Dedicated server with ssh access, then you can install mail() using the following command in ssh client

sudo apt-get install sendmail

After that, configure send mail with (choose yes to all)

sendmailconfig

Now recheck the form to see if it’s working

2) Install wp-smtp plugin and use SMTP to send mail

In case you are using a shared hosting without shell access or the hosting provider does not allow to enable php mail() => We will use SMTP to send mail (I strongly recommend this method as sending email from SMTP will have more trust and the email will not go to spam folder)

In this tutorial, we use WP-SMTP plugin to send mail via SMTP

STEP 1: Install WP-SMTP plugin

Go to Plugins > Add new and search for WP-SMTP, install and active the plugin

wpsmtp plugin

STEP 2: Configure WP-SMTP plugins

In WP SMTP setting, fill the information like this:

wpsmtp setting

Finally, save changes.

Now let’s try sending a test email using SMTP server in WP-SMTP setting

test mail smtp

If you see the message: Message sent => That means our installation succeeded

message sent

From now, Contactform 7 will use SMTP to send mail instead of PHP mail() function. (if you want to switch back to php mail() just disable WP-SMTP plugin)

Solution for Orange border error message

With my experience dealing with There was an error trying to send your message. Please try again later, error message in orange border, this error happens when the reCAPTCHA module is not working properly on your site

In wordpress admin section, go to Contact => Integration

recaptcha v3

Here you can change reCAPTCHA setting.

I recommend to remove previous site key and secret key and install new ones.

To get new reCAPTCHA key, go to: https://www.google.com/recaptcha/admin/create

Fill in the required field and select reCAPTCHA type as: reCAPTCHA v3

create new recaptcha keyProceed to the next step to get reCATPCHA key

recaptcha v3 key

Finally, insert these keys into reCAPTCHA module of contactform7 and save changes

fill in recaptcha keys

Now refresh your website and try again with Contactform7 submission.

Note: If reCAPTCHA V3 does not work for your site, you can try reCAPTCHA v2 key instead

Other error message with Contactform7

Another error message you may see is: One or more fields have an error. Please check and try again. This error message indicates that a required field is not being filled when a user submits the form. It’s possible that the field is hidden due to wrong configuration in contactform7 so that user can never fill into that form. 

You must accept the terms and conditions before sending your message. => There are terms and conditions user need to accept before submitting form

One or more fields have an error. Please check and try again. => Some fields have wrong data format

You can see all message errors and explanation here:

other message error contactform 7

Conclusion

Contactform 7 error is not easy to understand and solve if you are new to WordPress, it is related to not only wordpress but also server/hosting config.

I hope the tutorial will help you fix this issue. If you still experience the error, please drop a comment below and I will try my best to help you.

Hung Tran is the author of Wooexplorer.com, he loves to share knowledge about Woocommerce and Wordpress

2 Comments

  1. Can you fix the error after following my tutorial? Drop a comment here and I will help if you have any trouble

  2. Your method of explaining everything in this post is actually nice,
    all can without difficulty know it, Thanks a lot.
    Now my contactform7 is working properly after installing and configuring WPSMTP plugin

Write A Comment