linux下phpmailer发送邮件出现SMTP ERROR: Failed to connect to server: (0)错误
在做项目的过程中,后期客户提出了发送邮件的需求,既然客户有需求,那么没啥说的,上呗。 经过网上的一般资料查找,PHPMailer这个插件貌似用起来不错,那就从github clone一份来,下载链接是 PHPMailer。 官当demo如下:当然相关的配置要换成你自己的 //Create a new PHPMailer instance $mail = new PHPMailer ; //Tell PHPMailer to use SMTP $mail -> isSMTP (); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail -> SMTPDebug = 2 ; //Set the hostname of the mail server $mail -> Host = 'smtp.qq.com' ; //$mail->Host = 'smtp.163.com'; //Set the SMTP port number - likely to be 25, 465 or 587 $mail -> Port = 465 ; $mail -> SMTPSecure = "ssl" ; //$mail-