We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11139
    • 34 Posts
    My form is not sending email and I cannot understand why, despite staring at it for ages. I would be most grateful if one of you out there could tell me what I’m doing wrong.

    The code:
    [[!FormIt?
       &hooks=`email,redirect`
       &emailTpl=`FormitEmailChunk`
       &emailTo=`[email protected]`
       &emailFrom=`[email protected]`	
       &redirectTo=`25`
       &submitVar=`submit`
    ]]
    


    I have simplified the example form and removed some of the hooks, including the validation, trying to make it work. It redirects properly, so something’s happening, but no email shows up (yes, I looked in the spam folder). There’s no error message in the system error log.

    The FormitEmailChunk code is:
    <br />[[+name]] ([[+email]]) wrote: <br />
    [[+text]]
    



    Formit 1.5.4
    MODx Revolution 2.0.8-pl (traditional)
    PHP 5.2.9

    Many thanks to anyone who can sort me out

    Thomas
      • 8609
      • 607 Posts
      Can you post your form code? Do you have a url we can look at? Have you tried using a different emailTo address for testing?

      Might also be a good idea to mask you email addresses in your forum post
        • 11139
        • 34 Posts
        Hi Mary, thanks.

        The complete form page is:
        
        <h2>Contact Form</h2>
         <p>Please fill out the form if you wish to be added to the mailing list. 
        And you can leave a message too if you like</p>
        [[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
         
        <form action="[[~[[*id]]]]" method="post" class="form">
            <input type="hidden" name="nospam:blank" value="" />
         
        <table>
        <tr><td>
            <label for="name">
                Name (required):
                <span class="error">[[!+fi.error.name]]</span>
            </label>
            </td>
            <td>
            <input type="text" name="name" id="name" value="[[!+fi.name]]" />
         	</td>
         	</tr>
         	<tr>
         	<td>
            <label for="email">
                Email (required):
                <span class="error">[[!+fi.error.email]]</span>
            </label>
            </td>
            <td>
            <input type="text" name="email" id="email" value="[[!+fi.email]]" />
        	</td>
        	</tr>
         	<tr>
         	<td>
            <label for="text">
                Message (optional):
                <span class="error">[[!+fi.error.text]]</span>
            </label>
            </td>
            <td>
            <textarea name="text" id="text" cols="55" rows="7" value="[[!+fi.text]]">[[!+fi.text]]</textarea>
         	</td>
         	</tr>
        	<tr>
        	<td></td>
         	<td>
                <input type="submit" name="submit" value="Send Contact Inquiry" />
        	</td>
        	</tr>
        </table>
        
        </form>
        
        
        
        [[!FormIt?
           &hooks=`email,redirect`
           &emailTpl=`FormitEmailChunk`
           &emailTo=`[email protected]`
           &emailFrom=`[email protected]`	
           &redirectTo=`25`
           &submitVar=`submit`
        ]]
        
        


        The URL is http://www.tgsketches.me.uk/MODx/cranfordpetclub/

        Yes, I’ve tried different target email addresses

        (BTW, I’m trying to make a simple documented, annotated site for newbies like me, to take them one step further after setting up a site using your excellent guide. The documentation and annotation will be along later.)

        Thomas
          • 8609
          • 607 Posts
          Try placing the FormIt call before the form code, not after it.

          mary
            • 23299
            • 1,161 Posts
            Is this on a live server or are you local using MAMP or WAMP etc? Quite often local installs will not work when sending form emails
              • 11139
              • 34 Posts
              @Mary
              Try placing the FormIt call before the form code, not after it.
              No change. (I had tried before but I just tried again.)

              @Photowebmax
              Is this on a live server or are you local ...
              It’s on a remote shared host with commercial hosting. They don’t have any rules against sending email afaik.

              Very frustrating! Thank you for looking.

              Thomas
                • 3749
                • 24,544 Posts
                Try the installing the QuickEmail package. It will give you a quick test of whether the server’s email is working.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 11139
                  • 34 Posts
                  Quote from: BobRay at Mar 13, 2011, 07:16 PM

                  Try the installing the QuickEmail package. It will give you a quick test of whether the server’s email is working.

                  Thanks Bob. I just did that. It says ’Send reported successful’. I tried again with debug on, and it set my correct email address in all the right places - to:, fromName:, replyTo:, and emailSender: - so it’s not an addressing problem. (Great little snippet btw.)

                  I still didn’t get any email. But what I did get was an error report in the MODx error log, which seems to be generated when I preview the page with the email tester:
                   [2011-03-13 19:34:55] (ERROR @ /home/tgsketch/public_html/MODx/cranfordpetclub/core/cache/elements/modsnippet/22.include.cache.php : 81) PHP warning: stristr() [<a href='function.stristr'>function.stristr</a>]: Empty delimiter
                  
                  Maybe that makes sense to you, but I fear it’s beyond me.

                  Thomas
                    • 3749
                    • 24,544 Posts
                    I get that same error in the error log, BTW, but I still get the email. It’s a minor bug in how the default properties are processed. Look for a new version (1.0.4-rc1) in a day or two.

                    If you didn’t get an email from QuickEmail when it reported success (check your spam folder), it’s likely that something is wrong with the email system at your host -- or they’re blocking your emails for some reason.

                    You could switch to using SMTP by setting the MODx SMTP system settings for an account you have anywhere (e.g., GMail).

                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 11139
                      • 34 Posts
                      Quote from: BobRay at Mar 13, 2011, 09:38 PM

                      If you didn’t get an email from QuickEmail when it reported success (check your spam folder), it’s likely that something is wrong with the email system at your host -- or they’re blocking your emails for some reason.

                      I just checked with the hosting service. They can’t find any error reports at their end and have asked me to raise a ticket so they can look into it further.

                      Meanwhile, I’d better try the SMTP method.