解析php中用PHPMailer來(lái)發(fā)送郵件的示例(126.com的例子)
更新時(shí)間:2013年06月24日 11:08:14 作者:
本篇文章是對(duì)php中用PHPMailer來(lái)發(fā)送郵件的示例(126.com的例子)進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
<?php
require_once('../class.phpmailer.php');
$mail= new PHPMailer();
$body= "我終于發(fā)送郵件成功了!呵呵!goodboy xxxxxxx!<br/><a>http://news.qq.com/a/20111115/000792.htm?qq=0&ADUIN=594873950&ADSESSION=1321316731&ADTAG=CLIENT.QQ.3493_.0</a>";
//采用SMTP發(fā)送郵件
$mail->IsSMTP();
//郵件服務(wù)器
$mail->Host = "smtp.126.com";
$mail->SMTPDebug = 0;
//使用SMPT驗(yàn)證
$mail->SMTPAuth = true;
//SMTP驗(yàn)證的用戶名稱
$mail->Username = "xxxxxxx@126.com";
//SMTP驗(yàn)證的秘密
$mail->Password = "password";
//設(shè)置編碼格式
$mail->CharSet = "utf-8";
//設(shè)置主題
$mail->Subject = "測(cè)試";
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
//設(shè)置發(fā)送者
$mail->SetFrom('xxxxxxx@126.com', 'test');
//采用html格式發(fā)送郵件
$mail->MsgHTML($body);
//接受者郵件名稱
$mail->AddAddress("xxxxxxx@126.com", "test");//發(fā)送郵件
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
require_once('../class.phpmailer.php');
$mail= new PHPMailer();
$body= "我終于發(fā)送郵件成功了!呵呵!goodboy xxxxxxx!<br/><a>http://news.qq.com/a/20111115/000792.htm?qq=0&ADUIN=594873950&ADSESSION=1321316731&ADTAG=CLIENT.QQ.3493_.0</a>";
//采用SMTP發(fā)送郵件
$mail->IsSMTP();
//郵件服務(wù)器
$mail->Host = "smtp.126.com";
$mail->SMTPDebug = 0;
//使用SMPT驗(yàn)證
$mail->SMTPAuth = true;
//SMTP驗(yàn)證的用戶名稱
$mail->Username = "xxxxxxx@126.com";
//SMTP驗(yàn)證的秘密
$mail->Password = "password";
//設(shè)置編碼格式
$mail->CharSet = "utf-8";
//設(shè)置主題
$mail->Subject = "測(cè)試";
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
//設(shè)置發(fā)送者
$mail->SetFrom('xxxxxxx@126.com', 'test');
//采用html格式發(fā)送郵件
$mail->MsgHTML($body);
//接受者郵件名稱
$mail->AddAddress("xxxxxxx@126.com", "test");//發(fā)送郵件
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
您可能感興趣的文章:
- phplist及phpmailer(組合使用)通過(guò)gmail發(fā)送郵件的配置方法
- PHP借助phpmailer發(fā)送郵件
- thinkphp使用phpmailer發(fā)送郵件的方法
- phpmailer發(fā)送郵件之后,返回收件人是否閱讀了郵件的方法
- phpmailer在服務(wù)器上不能正常發(fā)送郵件的解決辦法
- php多種形式發(fā)送郵件(mail qmail郵件系統(tǒng) phpmailer類)
- PHP使用PHPMailer發(fā)送郵件的簡(jiǎn)單使用方法
- PHPMailer使用教程(PHPMailer發(fā)送郵件實(shí)例分析)
- 使用 PHPMAILER 發(fā)送郵件實(shí)例應(yīng)用
- PHPMailer郵件類利用smtp.163.com發(fā)送郵件方法
- phpmailer簡(jiǎn)單發(fā)送郵件的方法(附phpmailer源碼下載)
相關(guān)文章
PHP中實(shí)現(xiàn)多語(yǔ)言支持的幾種方式總結(jié)
本給大家介紹了PHP中實(shí)現(xiàn)多語(yǔ)言支持的幾種方式總結(jié), 使用數(shù)組或關(guān)聯(lián)數(shù)組,使用gettext擴(kuò)展和使用第三方庫(kù)這三種方式,文章通過(guò)代碼示例給大家介紹的非常詳細(xì),具有一定的參考價(jià)值,需要的朋友可以參考下2023-12-12php 8小時(shí)時(shí)間差的解決方法小結(jié)
前幾天發(fā)現(xiàn)一個(gè)問(wèn)題 date("Y-m-d G:i T",time()) 取出來(lái)的時(shí)間和本地時(shí)間老差8個(gè)小時(shí),可我的系統(tǒng)明明是中國(guó)標(biāo)準(zhǔn)時(shí)(GMT+8),最后終于找到了問(wèn)題所在。2009-12-12PHP實(shí)現(xiàn)順時(shí)針打印矩陣(螺旋矩陣)的方法示例
這篇文章主要介紹了PHP實(shí)現(xiàn)順時(shí)針打印矩陣(螺旋矩陣)的方法,涉及PHP基于數(shù)組遍歷、運(yùn)算模擬打印實(shí)現(xiàn)螺旋矩陣功能的相關(guān)操作技巧,需要的朋友可以參考下2018-01-01PHP實(shí)現(xiàn)的購(gòu)物車類實(shí)例
這篇文章主要介紹了PHP實(shí)現(xiàn)的購(gòu)物車類,可實(shí)現(xiàn)購(gòu)物車基本的加入、刪除、統(tǒng)計(jì)等相關(guān)功能,需要的朋友可以參考下2015-06-06php中html_entity_decode實(shí)現(xiàn)HTML實(shí)體轉(zhuǎn)義
這篇文章主要介紹了php中html_entity_decode實(shí)現(xiàn)HTML實(shí)體轉(zhuǎn)義的相關(guān)資料,需要的朋友可以參考下2018-06-06深入解讀php中關(guān)于抽象(abstract)類和抽象方法的問(wèn)題分析
這篇文章主要介紹了php中關(guān)于抽象(abstract)類和抽象方法的問(wèn)題分析,有需要的朋友可以參考一下2014-01-01php中關(guān)于token驗(yàn)證的相關(guān)問(wèn)題詳解
這篇文章主要介紹了php中關(guān)于token驗(yàn)證的相關(guān)問(wèn)題詳解的相關(guān)資料,需要的朋友可以參考下2023-05-05