时间:2021-07-01 10:21:17 帮助过:17人阅读
| 
本文介绍下,使用phpmailer发送yahoo邮件的例子,有需要的朋友,参考下吧。
 PHPMailer类发邮件的例子: 
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!";
}
?>
需要引入phpmailer类文件,下载地址:PHPMailer邮件发送类V5.1下载地址。  |