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

    I’m having real trouble setting up eForm to use SMTP with my Google hosted mail. I’ve searched the forum repeatedly and check the docs for eForm and phpmailer without any luck. At the moment it just errors every time.

    I’ll recount the steps I’ve taken so far:
    1. in class.phpmailer.php I’ve changed the lines to the suggested values and nothing else:

    var $Mailer            = "smtp";
    var $Host        = "smtp.gmail.com";
    var $Port        = 587;
    var $SMTPAuth     = true;
    var $Username     = "[email protected]";
    var $Password     = "password";


    2. In eform.inc.php I’ve changed and added the following wherever I found ’$mail->IsMail();’:

    //Changed
    $mail->IsSMTP();
    //Added
    $mail->Host = "smtp.google.com";
    $mail->SMTPAuth = true;
    $mail->Mailer = "smtp";
    $mail->Port = 587;
    $mail->Username = "[email protected]";
    $mail->Password = "password";


    3. My Snippet call:

    [!eForm? &formid=`EmailForm` &subject=`Website Inquiry` &to=`[email protected]` &ccsender=`0` &tpl=`contact-form` &report=`ContactFormReport` &gotoid=`49`!]


    4. The error:

    « MODx Parse Error »

    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »

    PHP error debug
    Error: fsockopen() [function.fsockopen]: unable to connect to smtp.google.com:587 (Connection timed out)
    Error type/ Nr.: Warning - 2
    File: /home/public_html/manager/includes/controls/class.smtp.php
    Line: 104
    Line 104 source: $tval); # give up after ? secs

    I’m using Modx 0.9.6.2 and eForm 1.4.4.5.

    Any help would be greatly appreciated. Thanks, Jamie
      • 26903
      • 1,336 Posts
      var $Host = "smtp.gmail.com";
      I get a reply from this on port 587, but not from this
      $mail->Host = "smtp.google.com";
      try changing this line to
      $mail->Host = "smtp.gmail.com";
      but you don’t need to do this if you’ve set your mailer up, which you have, it will take your defaults.
        Use MODx, or the cat gets it!
        • 28788
        • 79 Posts
        Ok thanks for that, silly error really. So should I be able to loose all the duplicate stuff from eform.inc.php if it’s been specified in class.phpmailer.php?

        The parse error is gone but I’m still getting an error:

        Main mail: Mailer was unable to send mailThe following From address failed: [email protected]


          • 26903
          • 1,336 Posts
          Ok thanks for that, silly error really. So should I be able to loose all the duplicate stuff from eform.inc.php if it’s been specified in class.phpmailer.php?
          Yes, your justoverriding it although its probably better to do this, i.e. leave your mailer class alone and override it in eform. Ok, you’ve now got a ’mail’ error which could be many things, check the mail log on your server, see what its saying, it could be other SMTP params. authentication etc.
            Use MODx, or the cat gets it!
            • 28788
            • 79 Posts
            I’m trying to find out if I can get access to my mail logs, they aren’t available via my control panel.

            In the mean time I was wondering about SSL as I read in a few places that SSL is required with gmail. Could that not being specified make a difference?
              • 26903
              • 1,336 Posts
              Could that not being specified make a difference?
              Yes it could but I don’t think you can specify these sort of params with phpMailer, I find it a bit basic in this respect, I use Swift mailer personally. The best thing to do at the mo is find out what the actual prob is from your logs.
                Use MODx, or the cat gets it!
                • 28788
                • 79 Posts
                Sadly my host just said the email is being stopped by Google so now I need to see if I can answers from them which I’m not looking forward to. There doesn’t seem to be any way of accessing logs for Google apps...

                This is the problem having the email hosted separate from the web host. Do you know if there is any way to not use SMTP if my domain isn’t the same as my email host if that makes sense?
                  • 3749
                  • 24,544 Posts
                  I think Google might have a problem with SMTP mail from outside the USA.

                  Don’t you have another email account somewhere else that you could use? I have one on each host I use and one from my broadband connection in addition to 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
                    • 28788
                    • 79 Posts
                    Thats interesting I’ll look into that.

                    All I have other than my Gmail stuff is webmail which is less than ideal but it does work so yeah I’ll have to go back to that.
                      • 3749
                      • 24,544 Posts
                      Quote from: suburbiaboy at Feb 11, 2009, 02:34 PM

                      Thats interesting I’ll look into that.

                      All I have other than my Gmail stuff is webmail which is less than ideal but it does work so yeah I’ll have to go back to that.


                      If you mean webmail at your hosting service, there’s a good chance that there’s an SMTP server there that you could go through (and SMTP clients that you could access your mail with, BTW).
                        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