We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45118
    • 123 Posts
    Quote from: Bruno17 at Sep 14, 2015, 02:45 PM
    did you try it with a very simple form at a resource with a very simple template (just formit and the form)
    and just the email - hook?
    Okay, I just tried this and the test works, hurray!! I'll try to add the hooks back in one by one and see where it stops working.
    • Maybe the last ',' in &validate property.
        • 45118
        • 123 Posts
        Okay! I did a whole bunch of tests, adding little bits of call and the form at the time. As soon as I add the label and input for email, it stops working.

        This is the working form:
        [[!FormIt?
           &hooks=`recaptchav2,spam,email,redirect`
           &emailTpl=`ContactUs_Email`
           &emailUseFieldForSubject=`1`
           &emailTo=`[email protected]`
           &emailFromName=`[[+name]]`
           &store=`1`
           &redirectTo=`36`
           &validate=`name:required,
              phone:required,
              subject:required,`
        ]]
        
        [[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
         
        <form action="[[~[[*id]]]]" method="post" class="form">
            <input type="hidden" name="nospam:blank" value="" />
        
            <p><label for="name">Name <em>(required)</em>:[[!+fi.error.name]]</label><br />
            <input type="text" size="40" name="name" id="name" value="[[!+fi.name]]" /><br /></p>
        
            <p><label for="company">Company:</label><br />
            <input type="text" size="40" name="company" id="company" value="[[!+fi.company]]" /><br /><br /></p>
         
            <p><label for="address">Address:</label><br />
            <input type="text" size="40" name="address" id="address" value="[[!+fi.address]]" /><br /></p>
         
            <p><label for="city">City:</label><br />
            <input type="text" size="40" name="city" id="city" value="[[!+fi.city]]" /><br /></p>
        
            <p><label for="state">State:</label><br />
            <select id="states_drpdwn" name="state" value="[[!+fi.state]]">[[!FormItStateOptions? &selected=`[[!+fi.state]]`]]</select><br /></p>
        
            <p><label for="zip">Zip Code:</label><br />
            <input type="text" size="10" name="zip" id="zip" value="[[!+fi.zip]]" /><br /><br /></p>
        
            <p><label for="phone">Telephone <em>(required)</em>:[[!+fi.error.phone]]</label><br />
            <input type="text" size="40" name="phone" id="phone" value="[[!+fi.phone]]" /><br /><br /></p>
        
            <p><label for="subject">Select a Subject <em>(required)</em>:[[+fi.error.subject]]</label><br />
               <label><input type="radio" name="subject" value="General Inquiry" [[!+fi.subject:FormItIsChecked=`General Inquiry`]]> General Inquiry</label><br />
               <label><input type="radio" name="subject" value="Literature Request" [[!+fi.subject:FormItIsChecked=`Literature Request`]]> Literature Request</label><br />
               <label><input type="radio" name="subject" value="CAD Files Request" [[!+fi.subject:FormItIsChecked=`CAD Files Request`]]> CAD Files Request</label><br />
            <br /></p>
         
            <p><label for="comments">Comments:</label><br />
            <textarea cols="50" rows="7" name="comments" id="comments" value="[[!+fi.comments]]">[[!+fi.comments]]</textarea><br /><br /></p>
        
            <p>
            [[!recaptchav2_render]]
            [[!+fi.error.recaptchav2_error]] 
            <br /></p>
        
            <p><input id="submit_btn" type="submit" value="Submit" /></p>
        </form>


        When I add this:
        <p><label for="email">Email:</label><br />
            <input type="text" size="40" name="email" id="email" value="[[!+fi.email]]" /><br /><br /></p>
        
        between phone and subject, I don't get an email back anymore.

        I can put a validator for email in the call like this:
        email:email:required,
        It validates nicely, but still no email send.
          • 45118
          • 123 Posts
          Quote from: Jako at Sep 15, 2015, 06:12 PM
          Maybe the last ',' in &validate property.
          No, that comma doesn't make a difference. Thanks anyway!
          • discuss.answer
            Does it redirect? Then I am pretty sure that it is not an email hook issue. It should have sent a mail then.

            Have you looked in your spam filter? Have you tried to enter some other mail addresses in the email field (The ISP could block the mails too for some reason)? Have you tried some other emailTo addresses you could retrieve mails with.
              • 45118
              • 123 Posts
              Quote from: Jako at Sep 15, 2015, 09:23 PM
              Does it redirect? Then I am pretty sure that it is not an email hook issue. It should have sent a mail then.

              Have you looked in your spam filter? Have you tried to enter some other mail addresses in the email field (The ISP could block the mails too for some reason)? Have you tried some other emailTo addresses you could retrieve mails with.
              Yes, it does redirect. As I mentioned above, I did receive emails just fine until I put an email field in my form.

              But I did (thanks for the suggestion) enter a "proper" email address in the email field and that did the trick!!! So, after some more tests, my conclusion is that entering an fake email address (I used [email protected] in my tests) avoids getting the error message to enter a valid email address but it does prevent something (??) to send out an email. Why? I would sure like to know, but for now my problem is solved!!
              • Your server's spam prevention may check an email address to make sure it's a real address before it sends the mail on.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 45118
                  • 123 Posts
                  Quote from: sottwell at Sep 16, 2015, 02:52 PM
                  Your server's spam prevention may check an email address to make sure it's a real address before it sends the mail on.
                  Does that mean that Formit handles the email field differently than for instance the address field? How does the server know that, in my tests, I entered a fake email address? I entered a fake street address and phone number too for that matter.
                  • You have to tell your mail server what email address to send the mail to. It may have a list of known non-viable email addresses that it simply doesn't even bother trying to send to. Maybe. I only suggested this as a possibility. It has nothing to do with FormIt or MODX.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 45118
                      • 123 Posts
                      Quote from: sottwell at Sep 16, 2015, 03:37 PM
                      You have to tell your mail server what email address to send the mail to. It may have a list of known non-viable email addresses that it simply doesn't even bother trying to send to. Maybe. I only suggested this as a possibility. It has nothing to do with FormIt or MODX.
                      Yes, you set the email address you want to send the email to in the Formit tag. That wasn't an issue at all. The problem was the email that got entered in the form on the webpage.