国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

PHPMailer:Featured email transfer class for PHP

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

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

由于 PHP 中只包含了一個 mail 函數(shù),所以 PHPMailer 是對其很大的增強(qiáng),相信是可以滿足很多人的需求的,呵呵。其主要包括兩個類文件:用于實(shí)現(xiàn)發(fā)送郵件功能的 class.phpmailer.php 和 smtp 實(shí)現(xiàn)的 class.smtp.php 。然后還有可以實(shí)現(xiàn)多種錯誤輸出的文件,以及很詳細(xì)的文檔。軟件發(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/

標(biāo)簽: PHP
主站蜘蛛池模板: 安化县| 西华县| 班戈县| 陇南市| 永定县| 大理市| 南溪县| 六枝特区| 上杭县| 灵武市| 宣威市| 庄河市| 洛川县| 黔西县| 湟源县| 乐清市| 渭源县| 崇义县| 德安县| 宁安市| 无极县| 饶阳县| 阜平县| 建瓯市| 阳曲县| 北海市| 措勤县| 鹤山市| 长武县| 五原县| 石首市| 海晏县| 富宁县| 汶上县| 噶尔县| 黄骅市| 乐安县| 通许县| 奎屯市| 广平县| 沐川县|