我不断收到此错误。
下面是我的代码:
<?php
ini_set("include_path", "phpmailer/");
require 'phpmailer/class.phpmailer.php';
$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->Host = 'smtp.gmail.com';
$mailer->Port='465';
$mailer->SMTPAuth = TRUE;
$mailer->Username = '[email protected]'; // Change this to your gmail adress
$mailer->Password = '****'; // Change this to your gmail password
$mailer->From = '[email protected]'; // This HAVE TO be your gmail adress
$mailer->FromName = 'Belmer'; // This is the from name in the email, you can put anything you like here
$mailer->Body = 'This is the main body of the email';
$mailer->Subject = 'This is the subject of the email';
$mailer->AddAddress('[email protected]'); // This is where you put the email adress of the person you want to mail
if(!$mailer->Send())
{
echo "Message was not sent<br/ >";
echo "Mailer Error: " . $mailer->ErrorInfo;
}
else
{
echo "Message has been sent";
}
?>
有人知道这个错误吗?非常感谢您的答复。
最佳答案
得到它了!谢谢大家的观看。
代码实际上没有问题,它必须在本地服务器上进行一些设置。我的解决方案是将文件上传到实时网络服务器,并且一切正常。