We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • This seems to be interesting. If possible, I want also to cooperate.

    I am working on the renewal of PHPMailer now.
      • 4310
      • 2,310 Posts
      @yama
      Help would be good smiley
          • 5924
          • 0 Posts
          I’m getting the following error upon form submission:

          SMTP Error: Could not connect to SMTP host. Main mail: Mailer was unable to send mailSMTP Error: Could not connect to SMTP host.


          I’m currently using gmail to relay my forms. I noticed there was no place in the configuration file to specify the connection prefix (like in class.phpmailer.php). Specifying ssl is required for authenticating through gmail.

          from class.phpmailer.php
          $SMTPSecure    = 'ssl';


          I currently have my form working through a simple phpmailer code to verify the host and credentials, however I cannot get it to send with eform sad

          Help?

          I added the following lines:

          eform.inc.php
          					$mail->IsSMTP(); // send via SMTP 
          					$mail->Host = $smtp_host; // SMTP servers 
          					$mail->Port = $smtp_port; // SMTP port 
          					$mail->SMTPAuth = $smtp_auth; // turn on SMTP authentication 
          					$mail->SMTPSecure = $smtp_secure;
          					$mail->Username = $smtp_user; // SMTP username 
          					$mail->Password = $smtp_pass; // SMTP password


          eform snippet
             /* new SMTP parameters */ 
             'smtp' => isset($smtp)? $smtp:false,
             'smtp_host' => isset($smtp_host)? $smtp_host:'smtp.googlemail.com',
             'smtp_port' => isset($smtp_port)? $smtp_port:465,
             'smtp_auth' => isset($smtp_auth)? $smtp_auth:'true',
             'smtp_secure' => isset($smtp_secure)? $smtp_secure:'ssl',
             'smtp_user' => isset($smtp_user)? $smtp_user:'[email protected]',
             'smtp_pass' => isset($smtp_pass)? $smtp_pass:'mypassword',


          I also added &smtp_secure=`ssl` to my [eform] call.


          Thanks in advance
            • 4310
            • 2,310 Posts
            Looking through the existing class.phpmailer.php & class.smtp.php code there is no variable $SMTPSecure
            Yama has updated to a new version on github and $SMTPSecure is in the class.phpmailer,php file, though I can’t see it in the class.smtp.php file.
            Have you tried setting the host as ssl://smtp.gmail.com, probably won’t work but worth a try.
              • 5924
              • 0 Posts
              What version of phpmailer are you using? I’ve updated to 5.1

              I tried setting ssl://mail.googlemail.com as the host, no luck sad

              I just find it really strange I can connect and send smtp mail using a basic phpmailer script but it’s not working through eform sad

              Have you tried using gmail as an SMTP relay through eForm?
                • 4310
                • 2,310 Posts
                I’ve only used the standard php mailer files that ship with MODX, not sure which version they are.
                I’ll try and test using my Google Mail account.
                  • 4310
                  • 2,310 Posts
                  By modifying around line 537 of /manager/includes/controls/class.phpmailer.php
                  Change :
                              if(strstr($hosts[$index], ":"))
                                  list($host, $port) = explode(":", $hosts[$index]);

                  To :
                              if(strstr($hosts[$index], "::"))
                                  list($host, $port) = explode("::", $hosts[$index]);

                  I then successfully sent with :
                  $smtp_auth = 'true';
                  $smtp_user = '[email protected]';
                  $smtp_pass = 'mypassword';
                  $smtp_host = 'ssl://smtp.gmail.com';
                  $smtp = 'true';
                  $smtp_port = 465;;

                  Let me know if it works for you.
                    • 5924
                    • 0 Posts
                    Ahhh yesss!! Thank you Bunk! What an interesting operator... "::"

                    FYI- You’re using the old version of phpmailer. I reverted back so I could use your solution though smiley

                    My reports are coming through unformated. Now I’m searching on how to enable the html reporting.

                    Thanks again!
                      • 5924
                      • 0 Posts
                      For some reason my html reporting is not formatting after I configured the SMTP relay.