Phpmailer配置

版本:PHPMailer_v2.0.4

<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();   
$mail->Host = "smtp.163.com";   
$mail->Port=25;
$mail->SMTPAuth = true;   
$mail->Username = "xxxx@163.com";     // SMTP用户名
$mail->Password = "xxxxx";     // SMTP密码
$mail->From = "xxxxx@163.com";     //发件人地址
$mail->FromName = "xxx";     //发件人
$mail->AddAddress("xcvxvzv@qq.com");
$mail->AddReplyTo("xxxx@163.com", "Information");    //回复地址
$mail->WordWrap = 50;     //设置每行字符长度
$mail->IsHTML(true);     // 是否HTML格式邮件
$mail->Subject = "Here is the subject";     //邮件主题
$mail->Body = "HERE is the message";     //邮件内容
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";    //邮件正文不支持HTML的备用显示

if(!$mail->Send())
{
  echo "Message could not be sent. <p>";
  echo "Mailer Error: " . $mail->ErrorInfo;
  exit;
}

echo "Message has been sent";
?>

posted @ 2012-05-09 09:24  CobbySung  阅读(677)  评论(0编辑  收藏  举报