2012年(29)
分类: 系统运维
2012-06-01 17:03:26
phpmailer 下载地址:
下载完成后,找到class.phpmailer. 、class.smtp.php两个类放到自己的目录下!
code:
include_once ("lib/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPAuth = true;
$mail->Port = 25;
$mail->Username = ""; // SMTP account username 发件用户名
$mail->Password = "123456"; // SMTP account password 发件密码
$mail->Host = "mail.163.com"; // SMTP server
$mail->From = ""; //发件人邮箱名称
$mail->AddAddress(""); //收件人邮箱
$mail->FromName = "admin"; //发件人名称
//$mail->cc=array(); //抄送
$subject = "测试头";
$message = "测试内容";
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->WordWrap = 200;
$mail->CharSet = 'UTF-8';
$mail->Send();