首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >PHPMailer - SMTP错误:从服务器发送邮件时密码命令失败

PHPMailer - SMTP错误:从服务器发送邮件时密码命令失败
EN

Stack Overflow用户
提问于 2014-02-21 14:49:31
回答 13查看 145.2K关注 0票数 76

我使用phpmailer()概念使用php脚本从共享服务器向用户发送邮件,但根据phpmailer代码,即使脚本中的所有内容都正确,我也无法发送邮件。

我的代码如下:

代码语言:javascript
运行
复制
  $message = " This is testing message from my server";

  $mail = new PHPMailer(); // create a new object
  $mail->IsSMTP(); // enable SMTP
  $mail->Host = "smtp.gmail.com";
  $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
  $mail->SMTPAuth = true; // authentication enabled
  $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
  $mail->Port = 465; // or 587
  $mail->IsHTML(true);
  $mail->Username = "moorthi.mrk10@gmail.com"; // My gmail username
  $mail->Password = "************"; // My Gmail Password
  $mail->SetFrom("moorthi.mrk10@gmail.com");
  $mail->Subject = "Test Mail from my Server";
  $mail->Body = $message;
  $mail->AddAddress($email);
   if($mail->Send())
      {
    print json_encode("SUCCESS");
}
else
{
    echo "Mailer Error: " . $mail->ErrorInfo;

}

注意:我使用“GMail”作为服务器,SMTPSecure为“ssl”,端口为"465“,用户名和密码为GMail用户名和密码。

我使用了VPS共享服务器,并在该服务器上保留了我的php脚本。

我认为我的php脚本没有问题,我不知道为什么它不能工作。

,我得到了这样的错误。

代码语言:javascript
运行
复制
  2014-02-21 12:30:11   CLIENT -> SERVER: EHLO jkcorporates.com
  2014-02-21 12:30:11   CLIENT -> SERVER: AUTH LOGIN
  2014-02-21 12:30:11   CLIENT -> SERVER: bW9vcnRoaS5tcmsxMEBnbWFpbC5jb20=
  2014-02-21 12:30:11   CLIENT -> SERVER: OTk0MTI0MTE0MA==
  2014-02-21 12:30:11   SMTP ERROR: Password command failed: 534-5.7.14 
  534-5.7.14 i-_eumA> Please log in via your web browser and then try again.
  534 5.7.14 54 k76sm17979938yho.18 - gsmtp
  2014-02-21 12:30:11   CLIENT -> SERVER: QUIT
  " The ERROR is  "  SMTP connect() failed.

请给出一些解决办法。

提前谢谢。

记住:我使用共享服务器名'VPS.mydomain.com‘,我想使用GMail作为我的SMTP服务器向用户发送邮件。

EN

Stack Overflow用户

发布于 2018-12-17 10:39:42

除非您完成g-mail帐户的两步验证并使用该密码,否则您的邮件将不会在线发送。

票数 0
EN
查看全部 13 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21937586

复制
相关文章

相似问题

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