我已經檢查openssl是否被我的wamp服務器使用,並且是檢查。但是我的代碼有什麼問題?SMTP - >錯誤:AUTH未被服務器接受:530 5.7.0必須首先發出STARTTLS命令。 c3sm5545732pax.9 - gsmtp PHPMailer
$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 = "[email protected]"; // SMTP server username
$mail->Password = "password"; // SMTP server password
$mail->AddReplyTo("[email protected]","ADMIN");
$mail->From = "[email protected]";
$mail->FromName = "SYSTEM";
$to = "[email protected]";
$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.';
感謝您的回答:D最好 – vietnguyen09 2014-01-23 08:40:09
這應該是公認的答案。簡單的錯字。 – 2017-11-14 19:14:31