当前位置:Gxlcms > PHP教程 > 关于用phpmailer发邮件的有关问题

关于用phpmailer发邮件的有关问题

时间:2021-07-01 10:21:17 帮助过:36人阅读

关于用phpmailer 发邮件的问题
小弟刚接触php不久,试着想用phpmailer 发送邮件,但是得到了以下的error message.. The following From address failed: example@163.com

以下是代码,本人学习php时间不长,所以水平不高,希望各位高手能多多帮忙,谢谢大家
require( "class.phpmailer.php ");
$mail = new PHPMailer();
$mail-> IsSMTP(); // telling the class to use SMTP
$mail-> Host = "smtp.163.com "; // SMTP server
$mail-> SetLanguage( "en ", "./phpmailer/language/ ");
$mail-> From = "example@163.com ";
$mail-> AddAddress( "123123123@hotmail.com ");

$mail-> Subject = "First PHPMailer Message ";
$mail-> Body = "Hi! \n\n This is my first e-mail sent through PHPMailer. ";
$mail-> WordWrap = 50;

if(!$mail-> Send())
{
echo 'Message was not sent. ';
echo 'Mailer error: ' . $mail-> ErrorInfo;
}
else
{
echo 'Message has been sent. ';
}
?>

------解决方案--------------------
error message.. The following From address failed: example@163.com

没有这个EMAIL地址嘛

人气教程排行