我試圖用PHPMailer創建電子郵件服務,IM接收和身份驗證錯誤以及用戶名和密碼都是正確的。PHPMailer - 身份驗證問題
這是我的代碼:
<?php
require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
$mail->SMTPDebug = 1;
$mail->Debugoutput = 'html';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = 「[email protected]";
$mail->Password = 「my gmail password」;
//Set who the message is to be sent from
$mail->setFrom(‘[email protected]', 'Nicolas El Mir');
//Set who the message is to be sent to
$mail->addAddress('[email protected]', 'Nicolas Mir');
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
$mail->Body = 'This is a plain-text message body';
$mail->AltBody = 'This is a plain-text message body';
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
感謝您的幫助!
請提供您看到的錯誤消息。 –
捲曲的引號正在查殺你的腳本 –