知识屋:更实用的电脑技术知识网站
所在位置:首页 > 编程技术  > PHP编程

简单测试PHPMailer发送邮件

发表时间:2014-09-05来源:网络

require './class.phpmailer.php';
$mail=new PHPMailer();
$mail->ContentType="text/html";
$mail->Encoding="base64";
$mail->IsSMTP();
$mail->Host="smtp.163.com";
$mail->SMTPAuth=true;
$mail->Username="test@163.com";
$mail->Password="123456";
$mail->SetFrom("test@163.com","test");
$content=<<<EMAIL
这是一封测试的邮件,请不要做过多的关注!
EMAIL;
$mail->Subject="邮件测试";
$mail->AddAddress("test@qq.com","newMail");
$mail->Body=$content;
if($mail->Send()){
 echo "发送成功!";
}else{
 echo "发送失败!".$mail->ErrorInfo;
}
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜