PHPMailer to use Gmail as SMTP server.Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host

前端 未结 4 1852
你的背包
你的背包 2020-12-01 18:30

i am trying to use phpMailer to send confirmation messages to users via email. my code is this:



        
相关标签:
4条回答
  • 2020-12-01 19:01

    wrong:

    $mail->Host = "ssl://smtp.gmail.com"; // specify main and backup server
    

    good:

    $mail->Host = "smtp.gmail.com"; // specify main and backup server
    
    0 讨论(0)
  • 2020-12-01 19:04

    From here

    2) Comment out the following lines of code in class.phpmailer.php

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

    Try this if you haven't already.

    0 讨论(0)
  • 2020-12-01 19:25

    in you php.ini make sure you have uncommented the line with

    extension=php_openssl.dll
    
    0 讨论(0)
  • 2020-12-01 19:27

    This page has code the author claims "worked flawlessly".

    The only real difference I see between his and yours is that his has:

    $mail->Mailer = "smtp";
    

    I guess I would start with his code exactly to see if it works, and then debug from there.

    0 讨论(0)
提交回复
热议问题