使用 PHPMAILER 发送邮件实例
生活随笔
收集整理的這篇文章主要介紹了
使用 PHPMAILER 发送邮件实例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<?php
include ('class/class.phpmailer.php');$config = array('host'=>'smtp.163.com','port'=>'25','user'=>'***','passwd'=>'****','from'=>'juva_zz@163.com','fromname'=>'鄭州',);
$subject = 'this is a test mail';
$body = '<table style="background:#dfdfdf"><tr><td>測試內容</td></tr><tr><td>這是內容</td></tr></table>';
$address='******@qq.com';
$username='本人';$mail = new PHPMailer();
$mail->CharSet = 'gb2312';
$mail->IsSMTP();
$mail->Host = $config['host'];
$mail->Port = $config['port'];$mail->From = $config['from'];
$mail->FromName = $config['fromname'];
$mail->SMTPAuth = true;$mail->Username = $config['user'];
$mail->Password = $config['passwd'];$mail->Subject=$subject;
$mail->AltBody="text/html";
$mail->MsgHTML($body);$mail->AddAddress($address,$username);if(!$mail->Send())
{echo "Mail Error :".$mail->ErrorInfo;
}else
{echo "恭喜發送成功!";
}
轉載于:https://www.cnblogs.com/yxbs/archive/2012/11/05/2755246.html
總結
以上是生活随笔為你收集整理的使用 PHPMAILER 发送邮件实例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 自己实现spring核心功能 三
- 下一篇: 将字符串的首字母变为大写