[英]SMTP -> ERROR: AUTH not accepted from server: 530 5.7.0 Must issue a STARTTLS command first
<?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";
?>
Trying from last 2 days, getting the error as 从最近2天开始尝试,得到的错误为
SMTP -> ERROR: AUTH not accepted from server: 530 5.7.0 Must issue a STARTTLS command first SMTP->错误:服务器未接受AUTH:530 5.7.0必须首先发出STARTTLS命令
SMTP Error: Could not authenticate. SMTP错误:无法验证。 Message could not be sent. 无法发送信息。
Mailer Error: SMTP Error: Could not authenticate. 邮件错误:SMTP错误:无法验证。
Already seen all possible questions in stackoverflow and other websites. 已经在stackoverflow和其他网站中看到了所有可能的问题。 Already changed SMTPSecure and Port to all possible values. 已经将SMTPSecure和Port更改为所有可能的值。 Tried gmail server and outlook server also. 尝试了Gmail服务器和Outlook服务器。 Changed SMTPsecure to STARTTLS and TLS also with respective ports. 还将具有相应端口的SMTPsecure更改为STARTTLS和TLS。 Removed SMTPAuth line also. 还删除了SMTPAuth行。 Tried every possible soultions i found through web. 尝试了所有我通过网络发现的可能的灵魂。
Is this because i am trying to run this on my localhost? 这是因为我试图在本地主机上运行它吗? (i am using XAMPP in windows 8, 64 bit) (我在Windows 8、64位操作系统中使用XAMPP)
Try using $mail->Port = 465; 尝试使用$ mail-> Port = 465; instead of 587 and check the difference in the below link. 而不是587,然后检查以下链接中的差异。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.