SMTP - >错误:服务器不接受AUTH:530 5.7.0必须首先发出STARTTLS命令。 c3sm5545732pax.9 - gsmtp PHPMailer

时间:2013-02-27 14:41:30

标签: phpmailer

我已经检查过我的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.';

3 个答案:

答案 0 :(得分:7)

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

答案 1 :(得分:2)

尝试更改主机选项,如下所示:

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

答案 2 :(得分:0)

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