【问题标题】:SMTP -> ERROR: AUTH not accepted from server: 530 5.7.0 Must issue a STARTTLS command firstSMTP -> 错误:服务器不接受身份验证:530 5.7.0 必须先发出 STARTTLS 命令
【发布时间】:2016-02-17 04:21:29
【问题描述】:
<?php
require("class.phpmailer.php");
require("class.smtp.php");
require("class.pop3.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use      SMTP
$mail->Host = "smtp.mail.yahoo.com";  // specify main and backup server
$mail->SMTPSecure = "SSL";
$mail->SMTPKeepAlive = true;
$mail->Port = "587";
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->SMTPDebug = 1;
$mail->Username = "abc@yahoo.com";  // SMTP username
$mail->Password = "xyz"; // SMTP password



$mail->From = "abc@yahoo.com";
$mail->FromName = "Prashant kumar";
$mail->AddAddress("pqr@gmail.com", "Yogesh");                 // name is    optional
$mail->AddReplyTo("mno@gmail.com", "Information");

$mail->WordWrap = 50;                                 // set word wrap to 50 characters
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = "Here is the subject";
$mail->Body    = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Message has been sent";
?>

从最近 2 天开始尝试,得到错误为

SMTP -> 错误:服务器未接受 AUTH:530 5.7.0 必须先发出 STARTTLS 命令

SMTP 错误:无法验证。无法发送消息。

邮件程序错误:SMTP 错误:无法验证。

已经在 stackoverflow 和其他网站上看到了所有可能的问题。 已将 SMTPSecure 和 Port 更改为所有可能的值。 也试过gmail服务器和outlook服务器。 将 SMTPsecure 更改为 STARTTLS 和 TLS 也使用各自的端口。 还删除了 SMTPAuth 行。 尝试了我通过网络找到的所有可能的灵魂。

这是因为我想在我的本地主机上运行它吗? (我在 Windows 8 64 位中使用 XAMPP)

【问题讨论】:

    标签: php email ssl


    【解决方案1】:

    尝试使用 $mail->Port = 465;而不是 587 并检查以下链接中的差异。

    【讨论】:

    • 您的服务器上有 SSL 证书吗?
    • 试试这个 $mail->SMTPSecure = "tls";
    猜你喜欢
    • 2011-07-13
    • 2013-02-13
    • 1970-01-01
    • 1970-01-01
    • 2014-06-27
    • 2015-02-04
    • 1970-01-01
    • 2016-05-16
    • 2016-04-07
    相关资源
    最近更新 更多