首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >PHPMailer中的"SMTP错误:无法进行身份验证“

PHPMailer中的"SMTP错误:无法进行身份验证“
EN

Stack Overflow用户
提问于 2010-10-17 00:57:07
回答 18查看 284.8K关注 0票数 62

我在一个通过Gmail发送电子邮件的简单脚本中使用了PHPMailer,但我收到了一个“未知错误”(至少对我来说是这样!):

SMTP错误:无法验证。错误: SMTP错误:无法进行身份验证。

SMTP服务器错误:不接受5.7.1用户名和密码。要了解更多信息,请访问535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 p38sm2467302mbk.16

我读过关于为SSL/TLS连接配置OpenSSL的文章,并且我也这么做了。Apache和PHP配置正确( OpenSSL扩展在PHP中运行,mod_ssl在Apache 2.2.16中运行)。

这是PHP脚本:

代码语言:javascript
复制
 <?php
  require_once ("PHPMailer\class.phpmailer.php");
  $Correo = new PHPMailer();
  $Correo->IsSMTP();
  $Correo->SMTPAuth = true;
  $Correo->SMTPSecure = "tls";
  $Correo->Host = "smtp.gmail.com";
  $Correo->Port = 587;
  $Correo->UserName = "foo@gmail.com";
  $Correo->Password = "gmailpassword";
  $Correo->SetFrom('foo@gmail.com','De Yo');
  $Correo->FromName = "From";
  $Correo->AddAddress("bar@hotmail.com");
  $Correo->Subject = "Prueba con PHPMailer";
  $Correo->Body = "<H3>Bienvenido! Esto Funciona!</H3>";
  $Correo->IsHTML (true);
  if (!$Correo->Send())
  {
    echo "Error: $Correo->ErrorInfo";
  }
  else
  {
    echo "Message Sent!";
  }
?>

用户名和密码都没问题,我在Thunderbird上试过了,没有任何问题。我还使用了SSL身份验证和端口465,得到了相同的错误。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3949824

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档