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="" />
<input type="text" name="name" id="name" value="[[!+fi.name]]" />
<input type="text" name="email" id="email" value="[[!+fi.email]]" />
<input type="submit" value="Send Contact Inquiry" />
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.
- Uninstalled Recaptchav2
- Uninstalled Formit as well as all previous versions
- Reinstalled Formit latest version
- Upgraded MODX to latest version
- Used QuickEmail to test email sending: ALL is successful and email received
- Manually purged the core/cache folder
- Checked Network responses on form submit: Status is 200, Method is POST, URL is correct, form values are correct
- Removed Recaptcha keys from system settings
- For form action I have tried
"[[~[[*id]]]]" as well as hard-coding the URL
- Triple-checked that the template chunk exists and has the correct name
- Checked Github issues and searched this forum
I’m at a loss.
Any more troubleshooting ideas?
MODX Cloud, Revolution 2.7.3-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?
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.
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
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.
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:
- Uninstall and Remove the Recaptchav2 snippet
- Delete the Google Recaptcha account <-- important
- Test that the form sends w/out Recaptcha configured
- Make a new Google Recaptcha account
- Reinstall Recaptchav2 snippet
LOTS of cache clearing throughout the process.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.