【问题标题】:SMTP -> ERROR: AUTH not accepted from server: 530 5.7.0 Must issue a STARTTLS command first. c3sm5545732pax.9 - gsmtp PHPMailerSMTP -> 错误:服务器不接受 AUTH:530 5.7.0 必须先发出 STARTTLS 命令。 c3sm5545732pax.9 - gsmtp PHPMailer
【发布时间】:2013-02-13 10:07:16
【问题描述】:

我已经检查了我的 wamp 服务器是否使用了 openssl,并且正在检查。但是我的代码有什么问题?

$mail = new PHPMailer(true); 
$body             = 'THIS IS YOUR USERNAME:'.$row['username'].' PASSWORD: '.$row['password'].'\n PLEASE DELETE THIS MESSAGE AFTER YOU READ THIS';
$mail->SMTPDebug = 1;
$mail->IsSMTP();                // tell the class to use SMTP
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Port       = 587;                    // set the SMTP server port
$mail->SMTPSecure = 'tsl'; 
$mail->Host = 'smtp.gmail.com';
$mail->Username   = "dan.villarea22@gmail.com";     // SMTP server username
$mail->Password   = "password";            // SMTP server password
$mail->AddReplyTo("system@dvts.com","ADMIN");
$mail->From       = "system@dvts.com";
$mail->FromName   = "SYSTEM";
$to = "dan.villareal22@gmail.com";
$mail->AddAddress($to);
$mail->Subject  = "First PHPMailer Message";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap   = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
$mail->Send();echo 'Message has been sent.';

【问题讨论】:

    标签: phpmailer


    【解决方案1】:

    将 $mail->SMTPSecure = 'tsl' 更改为 $mail->SMTPSecure = 'tls'

    【讨论】:

    • 感谢您的回答:D 最好的
    【解决方案2】:

    尝试如下更改主机选项:

    $mail->Host = "ssl://smtp.googlemail.com";

    【讨论】:

      【解决方案3】:

      尝试使用 $mail->Port = 465;而不是 587 并检查以下链接中的差异。
      What is the difference between ports 465 and 587?

      【讨论】:

        猜你喜欢
        • 2016-02-17
        • 2011-07-13
        • 1970-01-01
        • 1970-01-01
        • 2014-06-27
        • 2015-02-04
        • 2012-10-05
        • 1970-01-01
        • 2016-05-16
        相关资源
        最近更新 更多