FormIt not sending

Hi all,

I’ve not used FormIt before and wanted to set it up. I’ve installed the plugin and am following the example on the RTFM.

For now I’ve removed validation and recaptcha, but it’s still not working. The form renders but nothing gets sent. No error messages either.

My snippet and chunk calls are as such:

    [[$ContactForm]]

    [[!FormIt?
     &hooks=`email,redirect`
     &emailTpl=`EmailTpl`
     &emailTo=`me@gmail.com`
     &redirectTo=`7`
   ]]

My form is:

[[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p>`]]

<form action="[[~[[*id]]]]" method="post" class="form">
    <input type="hidden" name="nospam" value="" /> 
    <label for="name">
        Name:
        <span class="error">[[!+fi.error.name]]</span>
    </label>
    <input type="text" name="name" id="name" value="[[!+fi.name]]" />
    <label for="email">
        Email:
        <span class="error">[[!+fi.error.email]]</span>
   </label>
    <input type="text" name="email" id="email" value="[[!+fi.email]]" /> 
    <label for="subject">
        Subject:
        <span class="error">[[!+fi.error.subject]]</span>
    </label>
    <input type="text" name="subject" id="subject" value="[[!+fi.subject]]" />
    <label for="text">
        Message:
        <span class="error">[[!+fi.error.text]]</span>
    </label>
    <textarea name="text" id="text" cols="55" rows="7" value="[[!+fi.text]]">[[!+fi.text]] . 

My EmailTpl is simply:

<br />[[+name]] ([[+email]]) Wrote: <br /> 
[[+text]]

Would anyone know what I am doing wrong?

1 Like

Just to be sure: FormIt is installed?

Hi @meltingdog

Formit deppends on the e-mnail settings defined on Modx settings.
Did you check the e-mail settings in order to ensure that you defined a smtp server, username, password, outgoing port and SSL (if needed)?
If you go to the Formit menu and check your saved submissions, is it listed there?

Then here is an example of mine so you can guide through.

Form having formit tags:


[[!FormIt?
	&hooks=`email,FormItAutoResponder,FormItSaveForm`
	&formName=`Footer Contact Form`
	&emailTpl=`footerEmailTemplate`
	&emailTo=`email-of yours@mail.com,other-mail-of-yours@mail.com`
	&emailFrom=[[+contact_email]]
	&emailUseFieldForSubject=`1`
	&validate=`
		contact_email:email:required:maxLength=^75^,
		subject:required,
		contact_message:required`
	&successMessage=`<script>window.alert("Your contact was sent successfully");destroyScreenDimmer();</script>`
    &validationErrorMessage=`<script>window.alert("Validation errors were found. Please try again");destroyScreenDimmer();</script>`
	&fiarTpl=`footerEmailAutoResponder`
    &fiarSubject=`Your message was sent successfully`
    &fiarFrom=`do-not-reply@mail.com`
    &fiarFromName=`Your Website Name - Auto-Mailer`
	&fiarToField=contact_email
	&fiarReplyTo=[[+contact_email]]
	&fiarBCC=`email-of yours@mail.com,other-mail-of-yours@mail.com`
]]

[[!+fi.validation_error_message:notempty=`[[!+fi.validation_error_message]] ([[+errors]])`]]
<form action="[[~[[*id]]]]#footerForm" method="post" class="form" name="contact_form" id="contact_form" autocomplete="false" enctype="application/x-www-form-urlencoded" role="form" data-toggle="validator">

	<input type="text" name="contact_email" id="contact_email" placeholder="E-Mail" 
		required="required" class="newsletter-input blue-color d-block w-100 px-3 py-2 mb-2"/>

	<select name="subject" id="subject" required="required" class="newsletter-input d-block w-100 px-3 py-2 mb-2 blue-color">
	  <option value="" disabled selected>-- Choose an option --</option>
	  <option value="Suggestions">Suggestions</option>
	  <option value="Question">Question</option>
	  <option value="Information request">Information request</option>
	  <option value="Change/Improvement">Change/Improvement</option>
	  <option value="Malfunction">Malfunction</option>
	</select>
	
	<textarea name="contact_message" id="contact_message" rows="3" cols="30" placeholder="Message"
		required="required" class="newsletter-input blue-color d-block w-100 px-3 py-2 mb-2"></textarea>

	<div class="d-block text-right pt-1">
		<input type="submit" class="button-simple button-blue text-center text-white text-uppercase font-weight-bold px-5 py-2" value="Send" name="BottomSend" form="contact_form" onclick="javascript:activateScreenDimmer()" />			
	</div>
	[[!+fi.successMessage:notempty=`[[!+fi.successMessage]]`]]
</form>

Then the footerEmailTemplate.tpl will be the e-mail template sent to you having all details, and the footerEmailAutoResponder.tpl will have the HTML of the e-mail sent to your customer informing that the contact was received.

Here is an example of footerEmailTemplate.tpl:

						<tr>
							<td valign="top" align="left" colspan="2">
								<br /><br />
								<b>E-Mail: </b>[[+contact_email]]<br />
								<b>Subject: </b>[[+subject]]<br />
								<hr />
								<b>Message: </b><br /><pre>[[+contact_message]]</pre><br/><br/><hr />
							</td>
						</tr>

If the receiver of this e-mail replies, it will reply to your mailbox as defined above.
Same applies to the footerEmailAutoResponder.tpl

						<tr>
							<td valign="top" align="left" colspan="2">
								This is the information that you sent:<br /><br />
								<b>E-Mail: </b>[[+contact_email]]<br />
								<b>Subject: </b>[[+subject]]<br />
								<hr />
								<b>Mensage: </b><br /><pre>[[+contact_message]]</pre><br/><br/><hr />
							</td>
						</tr>

Hope it helps somwhow.

Please ping us again if you need more help :wink:
Cheers

1 Like

I’d start by installing QuickEmail and adding the following to a resource to see if email sending is configured properly:

[[!QuickEmail? &debug=`1`]]

If sending email doesn’t work, the email hook fails, and processing stops there.

1 Like

Check your SMTP settings… I had same issue. SMTP was not set correctly.

Try QuickEmail, if it sends try to remove a parameter and test again till it works. Also try the minimum call on the website:

[[!FormIt?
   &hooks=`recaptcha,spam,email,redirect`
   &emailTpl=`MyEmailChunk`
   &emailTo=`user@example.com`
   &redirectTo=`123`
]]

Sorry for the late reply - Yes it is.

Sorry for the late reply.

I tried this and it doesn’t throw any errors. I get the “Send reported successful” message.

But still I don’t receive anything in my inbox (or spam inbox).

I’m stumped.

I have tried both of these. All indicate that there are no problems, but I just do not get any results in my inbox (or spam folder). It’s really odd.

It must be getting blocked somewhere along the way then. Try sending a test mail to email-tester.com - that runs all sorts of diagnostics from spf to blacklists and spamassassin scores.

Hi all,

Think I found the issue. Seems that GMail has suddenly prevented me from receiving emails from myself. I was using the same from email address in the form as the one I was sending to. I changed it and it now works.

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