我试图用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!";
}
?>
感谢您的帮助!
请提供您看到的错误消息。 –
卷曲的引号正在查杀你的脚本 –