色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

PHPMailer安裝方法及簡單實例

打開你電腦里的php.INI文件,找到如下位置,添加紅線部分的內容,路徑就是你phpMailer存放的位置:
attachments/200611/29_150901_<aphpmailer.jpg src="http://www.songzi.org/blog/attachments/200611/29_150901_phpmailer.jpg">
保存,重啟apache.
然后借用readme里的一個例子,稍微改一下就可以用了,由于只做最簡單的測試,很多東西我注釋掉了。
send.php
復制代碼 代碼如下:
<?php
require("class.phpmailer.php");
$mail = new phpMailer();
$address = $_POST['address'];
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "mail.songzi.org"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "phpmailer@songzi.org"; // SMTP username
$mail->Password = "******"; // SMTP password
$mail->From = "phpmailer@songzi.org";
$mail->FromName = "songzi";
$mail->AddAddress("$address", "");
//$mail->AddAddress(""); // name is optional
//$mail->AddReplyTo("", "");
//$mail->WordWrap = 50; // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
//$mail->IsHTML(true); // set email format to 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 "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>

test.php 
復制代碼 代碼如下:
<html>
<body>
<h3>phpmailer Unit Test</h3>
請你輸入<font color="#FF6666">收信</font>的郵箱地址:
<form name="phpmailer" action="send.php" method="post">
<input type="hidden" name="submitted" value="1"/>
郵箱地址: <input type="text" size="50" name="address" />
<br/>
<input type="submit" value="發送"/>
</form>
</body>
</html>

php技術PHPMailer安裝方法及簡單實例,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 阳新县| 和平县| 乌拉特中旗| 竹溪县| 桐城市| 湘阴县| 米脂县| 洱源县| 勐海县| 安徽省| 海原县| 公安县| 蒙自县| 石阡县| 历史| 绩溪县| 朝阳县| 达孜县| 吐鲁番市| 平远县| 宁蒗| 肃南| 清水河县| 崇阳县| 延津县| 江西省| 舞钢市| 乡宁县| 定日县| 汕尾市| 石景山区| 金阳县| 正蓝旗| 潢川县| 沽源县| 广饶县| 华阴市| 定兴县| 临猗县| 应用必备| 汪清县|