We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6531
    • 154 Posts
    I am calling eForm from a chunk. It works fine on pages where the chunk is by itself on the page; but on a page where it is called by the ’LoggedOrNot’ snippet, it doesn’t work. I get this error:

    [tt]Main mail: Mailer was unable to send mailCould not instantiate mail function. [/tt]

    I need to have a form appear only when a user is logged in.

    The problem appears here:

    [tt][[LoggedOrNot? &yesChunk=`ContactFormCall` &noChunk=`NeedToLogIn`]][/tt]

    {{ContactFormCall}} =
    [tt][!eForm? &formid=`ContactForm` &subject=`[*ContactSubject*]` &to=`[*ContactEmail*]` &ccsender=`1` &tpl=`ContactForm` &report=`ContactFormReport` &invalidClass=`invalidValue` &requiredClass=`requiredValue` &cssStyle=`ContactStyles` &gotoid=`46` !]
    [/tt]
    where [*ContactSubject*] & [*ContactEmail*] are TVs.

    The same call works fine on other pages where ContactFormCall is NOT within the LoggedOrNot call.

    Anyone?

    THANKS!
      • 30223
      • 1,010 Posts
      This most likely has to do with the order in which MODx parses content. Template Vars are parsed before Chunks and after that come Snippets. So, when you place the eForm call directly in a page the TV vars will have been translated into values before the eForm snippet is run (making the ’to’ parameter value available to eForm).

      When using [[LoggedOrNot]] the first pass will will translate this into the {{ContactFormCall}}. On the second pass the chunk is translated into the eForm snippet call and because snippets are parsed after chunks within the same pass the eForm Snippet is run. Sadly the TV’s within the eForm snippet call have by then not yet translated to their values and so eForm ends up with nonsensical data.

      There is a solution to your problem but I’d have to look up the details when I’ve got access to my own PC. I’ll try later to see if I can come up with an example if no one else has.
        • 6531
        • 154 Posts
        Thanks, TobyL -- that makes sense to me.

        I worked around the issue by putting the Form on its own page with group-based access restrictions.

        So don’t sweat it.

        Thanks again
          • 19889
          • 616 Posts
          Hello,

          I’m getting the same error on a client’s side - unfortunately, I have no idea how to fix this - seemed to work before!

          this is the call I’m using:
          [!eForm? &formid=`feedback` &to=`[email protected]` &tpl=`eFormFeedback-de` &report=`eFormFeedbackReport` &thankyou=`eFormThankYou-de` &mailselector=`subject` &vericode=`1` &subject=`Website Anfrage` &language=`german`!]


          or this one:
          [!eForm? &formid=`feedback` &to=`[email protected]` &tpl=`eFormFeedback-[*tv-lang*]` &report=`eFormFeedbackReport` &thankyou=`eFormThankYou-[*tv-lang*]` &mailselector=`subject` &vericode=`1` &subject=`Website Anfrage` &language=`german`!]



          the error message is always the same:
          Main mail: Mailer was unable to send mailCould not instantiate mail function.

          Hope somebody has an idea how to fix this.
          Thank you in advance for your help.
            • 30223
            • 1,010 Posts
            Most mail problems invariably have something to do with how php is configured on the server. eForm uses the phpmailer class and configures it by default to use the php mail() function. That’s about all I can say about it. I’ve never experienced teh problem myself and I simply don’t know enough.

            However read through this topic to see if it brings you any further.

            You can also try setting phpmailer to use SMTP. You will have to replace all lines in eForm with:
            $mail->IsMail();

            to
            $mail->IsSMTP();


            You will also have to set several SMTP related properties of (or in)  the class.phpmailer.php class,. You can find this file in manager/includes/controls

            There’s some phpmailer documentation available at http://phpmailer.codeworxtech.com/ (Where I just noticed a more recent version of phpmailer but as far as I can see the SMTP related properties are unchanged)

            good luck.
              • 1920
              • 8 Posts
              Quote from: TobyL at Sep 17, 2008, 03:31 AM

              Most mail problems invariably have something to do with how php is configured on the server. eForm uses the phpmailer class and configures it by default to use the php mail() function. That’s about all I can say about it. I’ve never experienced teh problem myself and I simply don’t know enough.

              However read through this topic to see if it brings you any further.

              You can also try setting phpmailer to use SMTP. You will have to replace all lines in eForm with:
              $mail->IsMail();

              to
              $mail->IsSMTP();


              You will also have to set several SMTP related properties of (or in) the class.phpmailer.php class,. You can find this file in manager/includes/controls

              There’s some phpmailer documentation available at http://phpmailer.codeworxtech.com/ (Where I just noticed a more recent version of phpmailer but as far as I can see the SMTP related properties are unchanged)

              good luck.

              I’ll vouch for this setup when running MODx on IIS (Windows Server 2003) - not my first choice of OS’s, but it works. I searched the forum to find an answer to my error and this is the only on that seemed to work. Great job! Keep up the good work!
                • 15871
                • 105 Posts
                See my blog post here: http://zerogblog.com/2010/07/getting-modxs-eform-to-work-with-iis/ for the step-by-step for this.

                Cheers