我的 PHP 邮件程序有问题,PHP 邮件程序在我的本地主机上工作,但在实时服务器上不工作
这是我的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.';
}
?>
当我在服务器上运行它时显示此错误
SMTP Error: Could not authenticate. Message was not sent.Mailer error: SMTP Error: Could not authenticate.
请帮我
谢谢