PHPMailer

Today ,I encountered a problem.
Since the system of my computer is win7-64 bit, the PHP built-in function mail () can't work.
I want to introduce an open source third party library ,which called "PHPMailer",to you.


The official address:
http://phpmailer.worxware.com/


Old version download address :    
http://sourceforge.net/projects/phpmailer/files/


New version download address :    
http://code.google.com/a/apache-extras.org/p/phpmailer/downloads/list


When your download is complete, you should put the three class.***.php files into the project file.


Instructions for use:


<?php
require("class.phpmailer.php"); //下載的文件必須放在該文件所在目錄
$mail = new PHPMailer(); //建立郵件發送類
$address ="[email protected]";
$mail->IsSMTP(); // 使用SMTP方式發送
$mail->Host = "smtp.qq.com"; // 您的企業郵局域名
$mail->SMTPAuth = true; // 啓用SMTP驗證功能
$mail->Username = "[email protected]"; // 郵局用戶名(請填寫完整的email地址)
$mail->Password = "***********"; // 郵局密碼
$mail->Port=25;
$mail->From = "[email protected]"; //郵件發送者email地址
$mail->FromName = "liuyoubin";
$mail->AddAddress("$address", "a");//收件人地址,可以替換成任何想要接收郵件的email信箱,格式是AddAddress("收件人email","收件人姓名")
//$mail->AddReplyTo("", "");
 
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // 添加附件
//$mail->IsHTML(true); // set email format to HTML //是否使用HTML格式


$mail->Subject = "PHPMailer測試郵件"; //郵件標題
$mail->Body = "Hello,這是測試郵件"; //郵件內容
$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //附加信息,可以省略
 
if(!$mail->Send())
{
echo "郵件發送失敗. <p>";
echo "錯誤原因: " . $mail->ErrorInfo;
exit;
}
echo "郵件發送成功";




The open source third party library. When helping us a lot , its defect is low efficiency.
發佈了38 篇原創文章 · 獲贊 24 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章