We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34108
    • 66 Posts
    Hi fellow modxers smiley I’ve just recently made the change from Evolution to Revolution and am having trouble getting FormIt to actually send email.

    I’m sure this is a really newb question but I’d be very grateful for any help as I’ve been unable to find an answer.

    Basically the form is set up and validating fine, but when I hit submit it just refreshes the existing page. Below is my code:

    The contact form (template):

    [[!FormIt?
       &hooks=`email,redirect,spam`
       &emailTpl=`sent_email_template`
       &emailTo=`[email protected]`
       &emailSubject=`Enquiry via website`
       &redirectTo=`21`   
       &validate=`name:required,
    	      email:email,
    	      text:required`
        ]]
    
        [[!+fi.error.error_message:notempty=`<p class="error">[[!+fi.error.error_message]]</p>`]] 
    
        <form action="[[~[[*id]]]]" method="post" id="contact-form">
    
            <label for="name" >Name<span class="error">[[+fi.error.name]]</span></label>
            <input type="text" name="name" maxlength="60"  value="[[+fi.name]]" />
    
            <label for="email" >Email<span class="error">[[+fi.error.email]]</span></label>
            <input type="text" name="email" size="40" maxlength="40"  value="[[+fi.email]]" />
    
            <input type="hidden" name="phone" value="" /> 
    
            <label for="text">Message<span class="error">[[+fi.error.text]]</span></label>
            <textarea cols="40" rows="7" name="text" value="[[+fi.text]]">[[+fi.text]]</textarea>
    
            <input type="image" name="submit" class="submit" alt="Send" src="assets/images/global/send.png" />
    
        </form>
    


    sent_email_template (chunk):

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



    Any idea if it’s something wrong with my code, or a setting in modx or the FormIt package I need to change?

    Many thanks in advance for any help you can give me.

    Harmony
    • Are you sure that your localhost is able to send mail? Or do you have MODx configured to use your external email account (gmail, maybe?) as its SMTP server?
        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
        • 3749
        • 24,544 Posts
        Try downloading the QuickEmail package and preview the resource it installs. It can help diagnose email problems.

        Most localhost setups have no working mail server and it’s a huge pain to install and configure one.
        Most likely, you will have to configure MODx to use SMTP.

        Go to System -> System Settings and put SMTP in the search filter box at the upper right.

        FYI, these settings will work with Gmail:

        SMTP Authentication: Yes
        SMTP Connection Prefix: tls
        SMTP Hosts: smtp.gmail.com
        SMTP Password: yourGmailPassword
        SMTP Port: 465
        SMTP User: yourGmailUsername
        Use SMTP: Yes
          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
          • 34108
          • 66 Posts
          Susan - Thanks for your quick reply, no it doesn’t appear it was configured to use an email server which had me confused as that functionality worked out of the box for me with Evolution.

          BobRay - Thanks heaps for your detailed answer Bob, I updated my settings as you specified and that did the trick!! Much appreciated smiley
            • 3749
            • 24,544 Posts
            I’m glad it worked. Thanks for reporting back. smiley
              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
              • 29344
              • 18 Posts
              Thank you thank you thank you!!!!! I’ve been bleeding over this computer monitor trying to figure out why my form wouldn’t send me an email and your solution helped me out tremendously.

              Question though: Are there any special arrangements when porting this site from localhost onto a real server??
                • 34108
                • 66 Posts
                Hi Tavcorp smiley I’ve attached a screenshot of what I usually set my SMTP settings to now on a live site, hope it helps.

                I’ve been learning that there’s some things that are best left until you’re on a live test environment, as localhost can be a little temperamental - specifically anything to do with phpthumbof and formit. I don’t touch those things now until I’ve moved the site to a test environment on a live server.
                  • 29344
                  • 18 Posts
                  Thanks for the tips. I’ll keep that in mind!
                    • 40387
                    • 28 Posts
                    Quote from: BobRay at Jan 13, 2011, 07:21 AM
                    Try downloading the QuickEmail package and preview the resource it installs. It can help diagnose email problems.

                    Most localhost setups have no working mail server and it's a huge pain to install and configure one.
                    Most likely, you will have to configure MODx to use SMTP.

                    Go to System -> System Settings and put SMTP in the search filter box at the upper right.

                    FYI, these settings will work with Gmail:

                    SMTP Authentication: Yes
                    SMTP Connection Prefix: tls
                    SMTP Hosts: smtp.gmail.com
                    SMTP Password: yourGmailPassword
                    SMTP Port: 465
                    SMTP User: yourGmailUsername
                    Use SMTP: Yes

                    Thankss, Form worked!
                      • 44757
                      • 7 Posts
                      Quote from: tavcorp at May 21, 2011, 12:03 AM
                      Thank you thank you thank you!!!!! I've been bleeding over this computer monitor trying to figure out why my form wouldn't send me an email and your solution helped me out tremendously.

                      Ditto - thanks!

                      I'm using MAMP, so in System Settings > SMTP Host, I needed to set it as localhost:8887, rather than just localhost

                      Wunderbar wink