<meta charset="utf-8">
<?php
include("class.phpmailer.php");
include("class.smtp.php");
//获取一个外部文件的内容
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$body = '<h1>测试时间:'.date('Y-m-d H:i:s', time()).'</h1>';
//设置smtp参数
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPKeepAlive = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.qq.com";
$mail->Port = ;
//填写你的qq邮箱账号和密码
$mail->Username = "405621584@qq.com";
$mail->Password = "QQ邮箱的独立密码";
//设置发送方,最好不要伪造地址
$mail->From = "405621584@qq.com";
$mail->FromName = "Webmaster";
$mail->Subject = "注册验证";
$mail->AltBody = $body;
$mail->WordWrap = ; // set word wrap
$mail->MsgHTML($body);
//设置回复地址
$mail->AddReplyTo("chenshuox@126.com","Webmaster");
//添加附件,此处附件与脚本位于相同目录下
//否则填写完整路径
$mail->AddAttachment("attachment.jpg");
$mail->AddAttachment("attachment.zip");
//设置邮件接收方的邮箱和姓名
$mail->AddAddress("chenshuox@126.com","FirstName LastName");
//使用HTML格式发送邮件
$mail->IsHTML(true);
//通过Send方法发送邮件
//根据发送结果做相应处理
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}
?>