解析yahoo邮件用phpmailer发送的实例

2022-10-22,,,,

复制代码 代码如下:
<?php
require_once('../class.phpmailer.php');
$mail= new phpmailer();
$body= "我终于发送邮件成功了!呵呵!goodboy!<br/><a>http://news.qq.com/a/20111115/000792.htm?qq=0&aduin=594873950&adsession=1321316731&adtag=client.qq.3493_.0</a>";
//采用smtp发送邮件
$mail->issmtp();
//邮件服务器
$mail->host       = "smtp.mail.yahoo.com.cn";
$mail->smtpdebug  = 0;
//使用smpt验证
$mail->smtpauth   = true;
//smtp验证的用户名称
$mail->username   = "********@yahoo.cn";
//smtp验证的秘密
$mail->password   = "y*********";
//设置编码格式
$mail->charset  = "utf-8";
//设置主题
$mail->subject    = "测试";
//$mail->altbody    = "to view the message, please use an html compatible email viewer!";
//设置发送者
$mail->setfrom('*******@yahoo.cn', 'test');
//采用html格式发送邮件
$mail->msghtml($body);
//接受者邮件名称
$mail->addaddress("*********@yahoo.com", "test");//发送邮件
if(!$mail->send()) {
  echo "mailer error: " . $mail->errorinfo;
} else {
  echo "message sent!";
}

《解析yahoo邮件用phpmailer发送的实例.doc》

下载本文的Word格式文档,以方便收藏与打印。