您的位置:首页 > 编程语言 > PHP开发

PHP Pear Mail 测试程序

2012-03-03 14:40 267 查看
<?php
require_once 'Mail.php';

$from = "=?GBK?B?".base64_encode("hello")."?=<hello@163.com>";
$to = "=?GBK?B?".base64_encode("qq")."?=<"."10010@qq.com".">";

$body = "邮件测试内容";

$host = "smtp.163.com";
$username = "hello";
$password = "hahahaha";
$port= 25;

$headers = array ('From' => $from,
'To' => $to,
'port' => $port,
'Subject' => $subject,
'Mime-Version' => "1.0",
'Content-Type'=>"text/html; charset=gbk");
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!---$email---</p>");
}

flush();
ob_flush();
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  测试 php qq