Smtp错误:无法进行身份验证。发送邮件时出现问题。 [英] Smtp error: could not authenticate. Problem in sending mail.

查看:983
本文介绍了Smtp错误:无法进行身份验证。发送邮件时出现问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将错误视为SMTP错误:无法进行身份验证。

发送邮件时出现问题。



它在localhost中工作,但是上传到服务器后显示

getting the error as SMTP Error: Could not authenticate.
Problem in Sending Mail.

It is working in localhost, but after uploading to server it is showing

引用:

SMTP错误:无法进行身份验证。

发送邮件时遇到问题。

SMTP Error: Could not authenticate.
Problem in Sending Mail.





我尝试过:





What I have tried:

Quote:

require('phpmailer / class.phpmailer.php');



$ mail = new PHPMailer();

$ mail-> IsSMTP();

$ mail-> SMTPDebug = 0;

$ mail-> SMTPAuth = TRUE;

$ mail-> SMTPSecure =tls;

$ mail-> Port = 587 ;

$ mail-> Username =******@gmail.com;

$ mail->密码=****** ***;

$ mail-> Host =smtp.gmail.com;

$ mail-> Mailer =smtp;

$ mail-> SetFrom($ _ POST [userEmail],$ _ POST [userName]);

$ mail-> AddReplyTo($ _ POST [userEmail ],$ _POST [userName]);

$ mail-> AddAddress(akilesh1111@gmail.com);

$ mail-> Subject = $ _POST [subject];

$ mail-> WordWrap = 80;

$ mail - > MsgHTML($ _ POST [content]);



if(is_array($ _ FILES)){

$ mail- > AddAttachment($ _ FILES [ 'attachmentFile'] [ 'tmp_name的值'],$ _ FILES [ 'attachmentFile'] [ '名称']);

}



$ mail-> IsHTML(true);



if(!$ mail-> Send()){

echo

发送邮件时出现问题。

require('phpmailer/class.phpmailer.php');

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->Username = "******@gmail.com";
$mail->Password = "*********";
$mail->Host = "smtp.gmail.com";
$mail->Mailer = "smtp";
$mail->SetFrom($_POST["userEmail"], $_POST["userName"]);
$mail->AddReplyTo($_POST["userEmail"], $_POST["userName"]);
$mail->AddAddress("akilesh1111@gmail.com");
$mail->Subject = $_POST["subject"];
$mail->WordWrap = 80;
$mail->MsgHTML($_POST["content"]);

if(is_array($_FILES)) {
$mail->AddAttachment($_FILES['attachmentFile']['tmp_name'],$_FILES['attachmentFile']['name']);
}

$mail->IsHTML(true);

if(!$mail->Send()) {
echo "

Problem in Sending Mail.

联系邮件发送。

推荐答案

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


mail-> IsSMTP ();
mail->IsSMTP();


mail-> SMTPDebug = 0;
mail->SMTPDebug = 0;


这篇关于Smtp错误:无法进行身份验证。发送邮件时出现问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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