【问题标题】:PHPMailer keeps returning errorPHPMailer不断返回错误
【发布时间】:2014-07-18 08:35:14
【问题描述】:

这是我的 php 文件:

<?php

require 'PHPMailerAutoload.php';
$mail = new PHPMailer;

if(isset($_POST['send'])){
date_default_timezone_set('Etc/UTC');
$email = $_POST['email'];
$name = $_POST["name"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$mail -> isSMTP();
$mail->PluginDir = "/path/to/phpmailer/dir";
$mail -> SMTPDebug = 1;
$mail -> Host = "smtp.gmail.com";
$mail -> SMTPSecure = "ssl";
$mail -> Port = 465;
$mail -> SMTPAuth = true;
$mail -> Username = "xxx"; //username example@gmail.com
$mail -> password = "xxx"; //password

$mail -> setFrom("autobandendiscount@gmail.com", "Anwar Elbouhdifi");
$mail -> addAddress($email, $name);



$mail -> Subject = $subject;
$mail -> Body = $message;
$mail -> AltBody = $message;

if(! $mail -> send()){
    echo"message error: " . $mail -> ErrorInfo;
}else{
    echo"Success!" ;
}

}

?>

而邮件程序返回此错误

2014-05-28 22:51:05 客户端 -> 服务器:EHLO 本地主机 2014-05-28 22:51:05 客户端 -> 服务器:AUTH 登录 2014-05-28 22:51:05 客户端 ->服务器:YXV0b2JhbmRlbmRpc2NvdW50QGdtYWlsLmNvbQ== 2014-05-28 22:51:05 客户端-> 服务器:2014-05-28 22:51:05 SMTP 错误:密码命令失败:535-5.7.8 用户名和密码不被接受。在 535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 r5sm46692086wjq.26 - gsmtp 2014-05-28 22:51:05 CLIENT -> SERVER: QUIT SMTP connect() 中了解更多信息。消息错误:SMTP 连接()失败。

我知道它说用户名和密码不被接受,但我 100% 知道这是正确的密码和用户名。

【问题讨论】:

  • 您可能认为您输入的用户名和密码正确,但 Google 告诉您并非如此。检查他们提供的链接以尝试通过直接登录来解决它。
  • 它是否像以大写字母开头的密码一样简单,例如密码?

标签: php email mailer


【解决方案1】:

可能不是解决方案,但值得一试:用大 P 拼写密码。

【讨论】:

  • 如果这解决了问题,请标记为“接受”:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-16
  • 2017-08-15
相关资源
最近更新 更多