We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 125
    • 19 Posts
    Hello,

    I have enabled the "Contact Us" example page from the example website supplied during the installation of MODx. Other than applying a new template to change the appearance, I have made no changes to the example’s content. That’s almost true -- I did change the &to=`` parameter to &to=`[email protected]`, but I was only troubleshooting.

    Either way, changed or unchanged, I have not received an email after trying a few times.

    I think this is due to the fact that the mail() function in PHP on my web host does not work without first defining the mail server’s host name and a valid username/password combo. I read through the eForm documentation, many threads here, and I see no mention on how to define this information either with eForm or within the MODx configuration.

    Any help appreciated.

    Thank you,
    Rich
      • 125
      • 19 Posts
      Resolved.

      I had to hard code my host, user name and password in:

      modxroot/manager/includes/controls/class.phpmailer.php

      where modxroot is the root of the modx installation on the server.

      These are the three empty variables that I assigned values to in the file class.phpmailer.php:


      var $Host = ""; //mail.smtphost.com
      var $Username = ""; //emailusername
      var $Password = ""; //emailpassword

      I tracked this down by performing a text search on "mail(" in the file:

      modxroot/assets/snippets/eform/eform.inc.php

      and noticed the include path for phpmailer. (btw, great choice for a php email class.)

      I am open to suggestions for alternative methods "approved" by and for modx.

      This had absolutely nothing to do with eForm, so I apologize for posting in the incorrect forum. Please consider moving this topic to a location where some one might find the information useful.

      Thanks,
      Rich
        • 22303 MODX Staff
        • 10,725 Posts
        Does eForm not allow users to set these phpmailer settings from the snippet? Hardcoding those values in the class might work, but IMHO, the proper way is to set those values on the phpmailer object instance being used by eForm through snippet parameters.
          • 125
          • 19 Posts
          I know there must be another way but the site I am working on is in production while simultaneously being developed, and the client expressed a desire to immediately have a contact form available. I posted my resolution in hopes that some one would explain to me the proper way to go about it.

          Here is the eForm call(?) in my current Contact Us document:

          [!eForm? &formid=`ContactForm` &subject=`[+subject+]` &to=`[email protected]` &ccsender=`1` &tpl=`ContactForm` &report=`ContactFormReport` &invalidClass=`invalidValue` &requiredClass=`requiredValue` &cssStyle=`ContactStyles` &gotoid=`46`  !]


          How would I modify the above call to define the the phpmailer class variables $Host, $Username, and $Password? I would rather use methods that will not affect any future updates of MODx and it’s support files.

          Thanks,
          Rich
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: 4notrump at Oct 04, 2007, 09:15 AM

            How would I modify the above call to define the the phpmailer class variables $Host, $Username, and $Password? I would rather use methods that will not affect any future updates of MODx and it’s support files.
            I do not use eForm, but it would require that the snippet accept those parameters and set the values when using phpmailer. I do not know if it does currently or not, thus I asked the question...
              • 30223
              • 1,010 Posts
              Short answer. Sadly it currently does not sad
              Slightly longer answer: It’s been in the pipeline for a while and will eventually happen, although I’m not sure if it will be with phpmailer.