PHP邮件程序无法在live server上工作

PHP邮件程序无法在live server上工作,php,smtp,phpmailer,Php,Smtp,Phpmailer,我的PHP mailer有问题,PHP mailer在本地主机上工作,但在live server上不工作 这是我的mailer.php <?php require("phpmailer/class.phpmailer.php"); // path to the PHPMailer class $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Mailer = "s

我的PHP mailer有问题,PHP mailer在本地主机上工作,但在live server上不工作

这是我的mailer.php

 <?php require("phpmailer/class.phpmailer.php"); // path to the PHPMailer class
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Mailer = "smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "user@gmail.com"; // SMTP username
$mail->Password = "pswd"; // SMTP password

$mail->From = "example@gmail.com";
$mail->AddAddress("user@gmail.com");

$mail->Subject = "First PHPMailer Message";
$mail->Body = "Youy payment received";
$mail->WordWrap = 50;

if(!$mail->Send()) {
echo 'message not send';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent.';
}
?>
请帮帮我

谢谢


@briosheje是的,我确信我的用户名和密码是正确的,并且我的密码不包含任何特殊字符–user2894216

也许,您还必须将用户名设置为“发件人”

$mail->Username = "user2894216"; // SMTP username
$mail->Password = "pswd"; // SMTP password
$mail->From = "user2894216";

顺便说一句,对于gmailssl://smtp 邮件服务不需要写入域。只有用户名

尝试查找行
$mail->IsSMTP()告诉类使用SMTP并将其删除或注释,如下所示:

/$mail->IsSMTP()


这样就可以工作了

这包含什么错误消息<代码>$mail->ErrorInfo日志文件说明了什么?没有这些,你就在黑暗中挖掘…@汉基웃Panky显示此错误消息
SMTP错误:无法进行身份验证。邮件未发送。邮件程序错误:SMTP错误:无法进行身份验证。
您是否100%确定您的登录用户名和密码正确?也没有特殊的角色可以逃脱吗?此外,您确定SMTP端口465已实际打开吗?@briosheje是的,我确定我的用户名和密码正确无误,并且我的密码不包含任何特殊字符
$mail->Username = "user2894216"; // SMTP username
$mail->Password = "pswd"; // SMTP password
$mail->From = "user2894216";