There are many reasons why Contact Form 7 may not send an email. In this article, I am going to focus on the Contact Form 7 error message “Failed to send your message. Please try later or contact the administrator by another method“.
In October 2021, contract forms that were previously sending emails stopped working and return the message “Failed to send your message. Please try later or contact the administrator by another method“. I looked at the Contact Form 7 forum and verified that others were reporting the same issue. If Google’s reCAPTCHA integration was set up the error message appeared. If Google’s reCAPTCHA integration was removed the email was sent. This proved that the form was configured properly and there were no email service issues causing the error.
Unfortunately, the Contact Form 7 forum support was asking people to report all their installed plugins and to go to a default theme, but no progress was being made to correct the issue. I decided to do some deeper investigation.
Contact Form 7 Error Messages
When you edit a Contact Form 7 contact form there are tabs at the top: Form, Mail, Messages, and Additional Settings. Clicking on the Messages tab shows the list of messages that the contact form may return when the form is submitted. By default the message “Failed to send your message. Please try later or contact the administrator by another method” is sent if the Sender’s message failed to send AND if the Submission was referred to as spam. To understand why the error message was being displayed I changed the error message under “Submission was referred to as spam” to “Failed to send your message because it was viewed as spam. Please contact the administrator by another method“. With Google’s reCAPTCHA integration set up, I then filled out the contact form and submitted it. This time I got the error message “Failed to send your message because it was viewed as spam. Please contact the administrator by another method“. So I now knew that my form was being viewed as spam.
Contact Form 7 Spam Logging
Google’s reCAPTCHA integration is one of Contact firm 7’s spam protection modules. When I looked at reCAPTCHA there was no information to understand why the message was being identified as spam. However, I did have the Flamingo plugin installed. Flamingo is a message storage plugin for Contact Form 7. In 2019 Contact Form 7 and Flamingo releases provided spam logging to help identify why a message was being marked as spam.
Flamingo has Address Book and Inbound Messages. Inbound Messages is a list of all of the messages that are submitted. At the top there is Inbox and Spam. Clicking on Spam shows you a list of the messages marked as spam. I clicked on view under my test message and I saw that the Spam log: reCAPTCHA response token is empty.
Normally you would see something similar to Spam log: reCAPTCHA score (0.00) is lower than the threshold (0.50).
Spam log: reCAPTCHA response token is empty
Contact Form 7’s FAQ page lists “Spam log: reCAPTCHA response token is empty.” What does this mean?” and it says, “An empty reCAPTCHA token can happen for several different reasons. One of the common reasons is that reCAPTCHA’s script file is not loaded, or that it is malfunctioning. In most cases this is caused due to the ill-designed theme that is used on the site.“
In my case, I dismissed the ill-designed theme as the cause because I am using a popular and well-designed theme. However, the script file is not loaded was of interest to me. I am using a caching plugin to improve the performance of the website and I had checked “Delay JavaScript Execution”. When I unchecked this and cleared my cache my forms send without an error.
I have shared this information with Contact Form 7 on their forum, and I have asked which JavaScript files should be excluded from Dalying JavaScript Execution so I can still maximize the performance of my website while having my contact forms work.
If this is helpful to you, please let me know. If you have other information that you think will be helpful please share that as well.