SMTP->错误:服务器不接受密码 [英] SMTP -> ERROR: Password not accepted from server

查看:119
本文介绍了SMTP->错误:服务器不接受密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我创建了一个简单的html页面,该页面从Gmail帐户发送邮件.在开始时,它从页面发送邮件.但现在它显示了错误.

SMTP->错误:服务器不接受密码:535错误的身份验证数据

请帮助我,因为我陷入了困境.

这是我的代码:

Hello,

I created a simple html page that send a mail from Gmail account. at start it send mail from the page. but now it shows the error.

SMTP -> ERROR: Password not accepted from server: 535 Incorrect authentication data

Please Help me as i am stuck in that.

Here is my Code :

require_once ("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->IsHTML(true);
$mail->SMTPDebug  = 1;
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier ssl or tls
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server 465 or 587
$mail->Username = "mygmailaddress"; // GMAIL username $myemail
$mail->Password = "mypassword"; // GMAIL password

$mail->SetFrom('emailaddress','Admin'); // "name@yourdomain.com";
$mail->FromName = $yourname;  // set from Name
$mail->Subject = $subject;
$mail->Body = $message;

$mail->AddAddress("emailaddress"); // to Address

if($mail->Send())
{
echo "<html><body><span>Thank you for your enquiry. Please</span><a href=enquiry.html>Click Hear</a><span>to continue</span></body></html>";
}
else
{
echo "<html><body><span>Error in sending email. Please</span><a href=enquiry.html>Click Hear</a><span>to continue</span></body></html> ";
}

推荐答案

mail = PHPMailer();
mail = new PHPMailer();


邮件-> IsSMTP();
mail->IsSMTP();




邮件-> IsHTML(true);
mail->IsHTML(true);


这篇关于SMTP->错误:服务器不接受密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆