PHP Pear Mail 测试程序
【摘要】
<?php require_once 'Mail.php'; $from = "=?GBK?B?".base64_encode("hello")."?=<hello@163.com>"; $to = "=?GBK?B?".base64_encode("qq")."?=<"."10010@qq.com".">...
-
<?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();
-
?>
文章来源: blog.csdn.net,作者:fengda2870,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/fengda2870/article/details/7315018
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)