久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

PHPMailer:Featured email transfer class for PHP

瀏覽:156日期:2024-02-01 11:52:42

PHPMailer:Featured email transfer class for PHPPHPMailer 是一個很有用的 PHP 發(fā)送郵件的類。它支持使用 smtp 服務器發(fā)送郵件,同時支持 Sendmail, qmail, Postfix, Imail, Exchange, Mercury, Courier 等郵件服務器。SMTP服務器的話還支持驗證,多SMTP發(fā)送(不過不太清楚有什么用).郵件發(fā)送可以包括多個TO, CC, BCC and REPLY-TO,支持text和HTML兩種郵件格式,可以自動換行,支持各種格式的附件及圖片,自定義郵件頭等基本的郵件功能。

由于 PHP 中只包含了一個 mail 函數(shù),所以 PHPMailer 是對其很大的增強,相信是可以滿足很多人的需求的,呵呵。其主要包括兩個類文件:用于實現(xiàn)發(fā)送郵件功能的 class.phpmailer.php 和 smtp 實現(xiàn)的 class.smtp.php 。然后還有可以實現(xiàn)多種錯誤輸出的文件,以及很詳細的文檔。軟件發(fā)布遵循 LGPL 協(xié)議。

使用也很簡單,看下面的例子就明白了:

require('class.phpmailer.php');

$mail = new PHPMailer();

$mail->IsSMTP(); // send via SMTP $mail->Host = 'smtp1.site.com;smtp2.site.com'; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = 'jswan'; // SMTP username $mail->Password = 'secret'; // SMTP password 'www.mypchelp.cn$mail->From = 'from@email.com'; $mail->FromName = 'Mailer'; $mail->AddAddress('josh@site.com','Josh Adams'); $mail->AddAddress('ellen@site.com'); // optional name $mail->AddReplyTo('info@site.com','Information');

$mail->WordWrap = 50; // set word wrap $mail->AddAttachment('/var/tmp/file.tar.gz'); // attachment $mail->AddAttachment('/tmp/image.jpg', 'new.jpg'); $mail->IsHTML(true); // send as HTML

$mail->Subject = 'Here is the subject'; $mail->Body = 'This is the <b>HTML body</b>'; $mail->AltBody = 'This is the text-only body';

if(!$mail->Send()) { echo 'Message was not sent <p>'; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; }

echo 'Message has been sent';

詳見PHPMailer的主頁:http://phpmailer.sourceforge.net/

標簽: PHP
主站蜘蛛池模板: 张家港市| 桑植县| 揭西县| 浮梁县| 土默特右旗| 静宁县| 万源市| 驻马店市| 广安市| 云阳县| 合川市| 金坛市| 侯马市| 延川县| 隆德县| 巴彦县| 永寿县| 绩溪县| 揭阳市| 普格县| 广东省| 武宣县| 大丰市| 大足县| 农安县| 台东县| 赤水市| 集安市| 中宁县| 安远县| 察隅县| 洪泽县| 南乐县| 萍乡市| 赣州市| 宁明县| 阿城市| 会宁县| 舟山市| 崇礼县| 新郑市|