We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18339
    • 14 Posts
    This has been driving me crazy for a week. I have a FormIt snippet call on a client’s website that looks like this:

    [[!FormIt? &hooks=`recaptcha,spam,email,redirect`
               &emailTpl=`ContactFormEMail` 
               &emailSubject=`Someone Filled Out the Contact Form`
               &emailTo=`[email protected],
                         [email protected],
                         [email protected]` 
               &redirectTo=`60` 
               &validate=`fromname:required, 
                          fromemail:email:required, 
                          fromsubject:required,
                          description:required:stripTags` 
    ]]
    


    As written, filling out the form does nothing. It simply reloads the page at which this code resides, blanking the form and not sending an e-mail. The MODx Error Log reports: "(ERROR @ /index.php) [FormIt] An error occurred while trying to send the email. Could not instantiate mail function."

    I have removed the spam and recaptcha hooks, I have removed validation. I have set the page to uncached. I have cleared the cache. I have ripped FormIt completely out and reinstalled it from Package Management. The only thing that makes it work is to take out all but one of the recipients in &emailTo.

    This site is on Bluehost and their support people tell me there are no restrictions on the use of mail() in PHP that would cause multiple recipients to fail but a single one to work. Also, when creating a new user in the Manager, MODx sends a password e-mail without incident.

    I have read some posts here that suggest hacking FormIt or core, or using an SMTP server, but RTFM states that multiple recipients can be processed by FormIt without jumping through any hoops.

    The site is running 2.1.1-pl (traditional) and FormIt 1.6.0 rc1. No update to FormIt appears to be available. It also didn’t work in previous versions, and as part of my troubleshooting I upgraded to the latest MODx and FormIt.

    I don’t usually run into this situation with FormIt but in this particular case I need to send these contact forms to three addresses. Would appreciate any help you could provide, as this is a paid job for a client who has been very good to me.
    • I ran in to this same issue recently so this is probably a FormIt bug, anyways what I did was use &emailCC to add a secondary recipient in your case you can also use &emailBCC as well in order to send it to 3 people.

      Hope that helps.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 18339
        • 14 Posts
        This is the current code, per your suggestion:

        [[!FormIt? &hooks=`spam,email,redirect`
                   &emailTpl=`ContactFormEMail` 
                   &emailSubject=`[Client Name] Contact Form`
                   &emailTo=`[email protected]`
                   &emailCC=`[email protected]`
                   &emailBCC=`[email protected]`
                   &redirectTo=`60` 
                   &validate=`fromname:required, 
                              fromemail:email:required, 
                              fromsubject:required,
                              description:required:stripTags` 
        ]]
        


        The contact page still behaves exactly the same, and the error message in the MODx Error Log is exactly the same.

        Is there any sort of debugging behavior I can turn on to get some more information about that error?
          • 35143
          • 2 Posts
          Have you checked your error logs within cPanel? It sounds like it is rejecting at least one of your email recipients. I am guessing that you are using an email address that has the same domain as the site you are working on, but the email address doesn’t exist in cPanel.

          If it doesn’t, then add the email address in cPanel (under Mail > Email Accounts) and then go to "MX Entry" and choose "Remote Mail Exchanger" under Email Routing (choose the correct domain if you have subdomains).

          I had this happen before with Bluehost using an email address with the same domain whose email that server did not locally handle.
            • 18339
            • 14 Posts
            I have figured out what was going on.

            One of the e-mail addresses I was using fails for some reason. It is an e-mail address with the same domain as the website, however the mail is handled elsewhere. So even though the MX record for the domain points to a completely different server, Bluehost’s PHP apparently thinks it can send to a local account with that e-mail address, which doesn’t exist.

            If I take that e-mail address out, it doesn’t matter how many I put in the FormIt call, it works just as you’d expect it to.

            I will be following up with Bluehost to see if this is a bug on their side.

            I have also learned that the way around something like this is to use an external SMTP server instead of letting PHP decide.

            In the meantime, would appreciate advice on what info I need on Bluehost’s SMTP servers to use them with MODx, and what I need to set up in MODx to make it work.

            Thanks all.
              • 37246
              • 128 Posts
              Mark, I'm having the same issue with bluehost. Attempting to have them configure the account to not accept mail locally, we'll see if it works...
                I LOVE MODX! | greyskymedia.com
                • 37246
                • 128 Posts
                it did
                  I LOVE MODX! | greyskymedia.com