代码如下:
// 请求 PHPmailer类 文件
require_once("class.phpmailer.php");
//发送Email函数
function smtp_mail ( $sendto_email, $subject, $body, $extra_hdrs, $user_name) {
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "smtp.163.com"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "jessiejl"; // SMTP username 注意:普通邮件认证不需要加 @域名
$mail->Password = "1983106"; // SMTP password
$mail->From = ""; // 发件人邮箱
$mail->FromName = "WWW.NIUTW.COM"; // 发件人 ,比如 唯美搭配网
$mail->CharSet = "GB2312"; // 这里指定字符集!
$mail->Encoding = "base64";
$mail->AddAddress($sendto_email,$user_name); // 收件人邮箱和姓名
$mail->AddReplyTo("","Web之家");
//$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment 附件1
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); //附件2
$mail->IsHTML(true); // send as HTML
$mail->Subject = $subject;
// 邮件内容 可以直接发送html文件
$mail->Body = <<
上一篇:PHP工厂模式的好处有哪些