<?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();
?>