Formit w/Recaptcha Not Sending Email

Formit not sending email.

My test form and snippet call:

<form action="https://www.domain.com/contact-form-testing" method="post" class="form" >
    <input type="hidden" name="contact-form" value="" />

    <label for="name">
        Name:
    </label>
    <input type="text" name="name" id="name" value="[[!+fi.name]]" />

    <label for="email">
        Email:
    </label>
    <input type="text" name="email" id="email" value="[[!+fi.email]]" />

    <input type="submit" value="Send Contact Inquiry" />
</form>

[[!FormIt?
   &hooks=`email`
   &submitVar=`contact-form`
   &emailTpl=`MyEmailChunk`
   emailSubject=`Testing`
   emailFrom=`from@email.com`
   &emailTo=`to@email.com`
]]

A form on this site worked previously. In fact it worked too well, and was getting a lot of spam submissions. So I installed ReCaptchav2, and that is when the original form stopped working. I have added a test form (without recaptcha) on a blank page with an empty template. It will not send the email either.

I have:

  1. Uninstalled Recaptchav2
  2. Uninstalled Formit as well as all previous versions
  3. Reinstalled Formit latest version
  4. Upgraded MODX to latest version
  5. Used QuickEmail to test email sending: ALL is successful and email received
  6. Manually purged the core/cache folder
  7. Checked Network responses on form submit: Status is 200, Method is POST, URL is correct, form values are correct
  8. Removed Recaptcha keys from system settings
  9. For form action I have tried "[[~[[*id]]]]" as well as hard-coding the URL
  10. Triple-checked that the template chunk exists and has the correct name
  11. Checked Github issues and searched this forum

I’m at a loss.
Any more troubleshooting ideas?

MODX Cloud, Revolution 2.7.3-pl
Formit 4.2.5-pl

EDIT: Error Log shows this-

(ERROR @ /www/core/model/modx/modparser.class.php : 541) Could not find snippet with name recaptchav2_render.

So it is still expecting Recaptcha somewhere, even though that extra is uninstalled and NOT added as a hook in this form?

Hi @lucy,

You may wish to send in a support ticket to MODX Cloud, we could potentially see what’s going on on the server side or in the site as well. We could report back the issues here to help out others in the future. You can also leave action blank. It doesn’t really need to be set.

Thanks Jay! Submitted a ticket. :smile:

Just out of curiosity, have you tried giving the submit var input a value?

<input type="hidden" name="contact-form" value="1" />

Thanks for that thought @inside-creative. I haven’t, but the original form is working now.

I had to delete the Google Recaptcha account for that domain, then MODX Cloud support and I tested the form and it started working again without the Recaptchav2 hook. (Previously I had removed the Recaptchav2 hook from the form, but not deleted the Google Recaptcha account, and somehow it was still blocking the form submission. I don’t pretend to understand.)

So then I had to recreate the Google Recaptcha account and install the Recaptchav2 extra and configure it.

Hoping to never have to type the word Recaptcha ever again in my life.

Something to always keep in mind for others debugging email is to check to make sure that there is an SPF record for the sending email address to allow the site to send emails on it’s behalf as well. Many email clients and hosts will automatically junk or possibly not even transmit emails of there’s no SPF record or the SPF record doesn’t limits what servers can send emails.

For more information about SPF we have an article at MODX Cloud Support that offers some general information and specifics for MODX Cloud: https://support.modx.com/hc/en-us/articles/216758768-Sender-Policy-Framework-Records-SPF-

Thanks Jay. Could you confirm my current understanding –
If a MODX Cloud site has SMTP configured to send mail, and is not using an ESP, this TXT record (below) will allow sending from the site (assuming the A record for the domain has been set to the MODX Cloud ip), and also allow the company’s inbound email from the mail server:

v=spf1 a mx ~all

Hi Lucy,

If you’re using SMTP, the server may not need the A record included because it’s not technically sending email. If SMTP is being used you do need SPF records for whatever mail servers are sending email. Sometimes with SMTP you might be using a 3rd party server that will require either an inclusion or IP inclusion.

If the mailserver(s) listed in your SMTP settings in MODX have MX records, you likely don’t need the a part of the SPF and it may have not actually been a factor here. But, it wouldn’t hurt to have the a in the SPF for security reasons to help prevent spoofing of the domain emails.

Sorry if this is a bit confusing.

You might want to try Bob Ray’s QuickEmail for debugging: https://modx.com/extras/package/?id=quickemail

Thanks @rolandtom that is in my original post as one of the debugging steps I tried. Very useful snippet.

1 Like

For anyone coming upon this thread, the Formit form is now submitting and sending mail properly. This is what I think was the problem: There was some miscommunication between the Google Recaptcha account for the domain and the Recaptchv2 snippet installed on the site. Possibly one of the keys was bungled. What ended up working was:

  1. Uninstall and Remove the Recaptchav2 snippet
  2. Delete the Google Recaptcha account <-- important
  3. Test that the form sends w/out Recaptcha configured
  4. Make a new Google Recaptcha account
  5. Reinstall Recaptchav2 snippet
    LOTS of cache clearing throughout the process.
2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.