More fixes

Contact Form 7: "There was an error trying to send your message"

A visitor fills in your contact form, presses Send, and gets "There was an error trying to send your message. Please try again later." Most of them do not try again, so every one of these is a lost enquiry. Contact Form 7 shows this same sentence for two different problems: the email could not be sent, or the message was judged to be spam. The colour of the box around it tells you which. Here is how to find the cause in a few minutes.

What the visitor sees

yourbusiness.com/contact/

What the checks found


  

Which problem is it? (five minutes)

  1. Send the form yourself and look at the box colour. A red border means WordPress tried to send the email and the server refused. An orange border means Contact Form 7 marked the message as spam and did not send it. A yellow border is a different message ("One or more fields have an error") and just means a field was left empty or filled in wrong.
  2. Red: check whether the site can send any email. Use Lost your password on the login page, or install a mail test plugin (WP Mail SMTP and FluentSMTP both have a "send test email" screen). If nothing arrives from anywhere on the site, the host is not sending mail, which is common on cheap and cloud hosting.
  3. Red: open the form's Mail tab. Contact Form 7 puts a warning at the top of the form editor when the From address does not belong to your site's domain, for example a Gmail address in the From field. Many hosts refuse to send that.
  4. Orange: think about what changed. A new or moved domain with old reCAPTCHA keys, Akismet switched on, or a word list in Settings, Discussion, "Disallowed Comment Keys" (Contact Form 7 checks messages against it) all make real enquiries look like spam.
  5. Spinner that never stops, or the error comes back instantly: open the browser's developer tools, Network tab, and send again. A request ending in /feedback that returns 401, 403 or 404 means a security plugin, firewall or server rule is blocking the WordPress REST API the form posts to.

Fix it, safest first

  1. Stop losing the enquiries while you fix it. Install the free Flamingo plugin (by the Contact Form 7 author). It saves every submission inside WordPress, so even a failed email leaves a copy you can answer.
  2. Send mail through a real mailbox. Install an SMTP plugin and connect it to a mailbox on your own domain, or to your email provider's or a sending service's SMTP details. Send its test email and confirm it arrives. This fixes most red-box errors for good, and the WordPress emails not sending guide walks through it.
  3. Fix the From address. In the form's Mail tab, set From to an address on your own domain, such as [_site_title] <wordpress@yourbusiness.com>, and put the visitor's address in Additional Headers as Reply-To: [your-email]. Never put the visitor's address in From; the receiving server will treat it as forged.
  4. Check the To address. A typo, a mailbox that no longer exists, or a full inbox can make the server refuse the message. Send to an address you have just tested.
  5. For an orange box, fix the spam check that is too strict. In Contact, Integration, reset reCAPTCHA and paste keys made for this exact domain (a key made for the old or staging domain fails every time). Clear any list in Settings, Discussion, Disallowed Comment Keys that holds common words. If Akismet is on, test with a different message text.
  6. Let the form reach WordPress. In the security plugin, allow the REST API for logged-out visitors, or at least the contact-form-7 route. If a page cache serves an old copy of the contact page, exclude that page from caching and clear the cache.
  7. Test from a phone on mobile data. Fill in the form as a stranger would, then confirm the email arrives and is not in spam. If it lands in spam, the emails going to spam guide covers the domain settings.

What you see, what it means, what it needs

What you seeWhat it meansUsual fix
Red box, and password-reset emails never arrive eitherThe host does not send mailSMTP plugin with a real mailbox; send a test email
Red box, form editor warns the sender address does not belong to the siteFrom is on another domain (often Gmail)From on your own domain, visitor in Reply-To
Orange box after a domain move or a new sitereCAPTCHA keys made for another domainNew keys for this domain in Contact, Integration
Orange box for some visitors onlyDisallowed words, Akismet or a strict reCAPTCHA scoreClear the word list; test without Akismet
Error right away, Network tab shows 401/403/404 on /feedbackThe REST API is blockedAllow the contact-form-7 route in the security plugin
Form says sent, but nothing arrivesMail was accepted and then filteredCheck spam; set up SPF/DKIM; keep Flamingo on

What not to do

Most cases are a host that will not send mail, fixed with an SMTP plugin in under half an hour. If the box stays red or orange after these steps, that is what the box below is for. Related: WordPress emails not sending, emails going to spam, contact form spam, REST API error.