Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php SMTP->;错误:不接受来自服务器的身份验证:530 5.7.0必须首先发出STARTTLS命令_Php_Email_Ssl - Fatal编程技术网

Php SMTP->;错误:不接受来自服务器的身份验证:530 5.7.0必须首先发出STARTTLS命令

Php SMTP->;错误:不接受来自服务器的身份验证:530 5.7.0必须首先发出STARTTLS命令,php,email,ssl,Php,Email,Ssl,从最近2天开始尝试,错误如下 SMTP->错误:不接受来自服务器的身份验证:530 5.7.0必须首先发出STARTTLS命令 SMTP错误:无法进行身份验证。无法发送消息 邮件程序错误:SMTP错误:无法进行身份验证 已经在stackoverflow和其他网站上看到了所有可能的问题。 已将SMTPSecure和端口更改为所有可能的值。 还尝试了gmail服务器和outlook服务器。 将SMTPsecure更改为STARTTLS和TLS,并使用各自的端口。 还拆下了SMTPAuth线路。 尝试

从最近2天开始尝试,错误如下

SMTP->错误:不接受来自服务器的身份验证:530 5.7.0必须首先发出STARTTLS命令

SMTP错误:无法进行身份验证。无法发送消息

邮件程序错误:SMTP错误:无法进行身份验证

已经在stackoverflow和其他网站上看到了所有可能的问题。 已将SMTPSecure和端口更改为所有可能的值。 还尝试了gmail服务器和outlook服务器。 将SMTPsecure更改为STARTTLS和TLS,并使用各自的端口。 还拆下了SMTPAuth线路。 尝试了我在网上找到的所有可能的解决方案

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

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

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

您的服务器上是否有SSL证书?请尝试此$mail->SMTPSecure=“tls”;你的服务器上有SSL证书吗?试试这个$mail->SMTPSecure=“tls”;
<?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";
?>