惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
Vercel News
Vercel News
H
Help Net Security
Martin Fowler
Martin Fowler
美团技术团队
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园 - 司徒正美
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
宝玉的分享
宝玉的分享
小众软件
小众软件
T
Tailwind CSS Blog
WordPress大学
WordPress大学

博客园 - 情义俩难全

使用shale实现jsf客户端验证(原创) ssh创建全过程 myeclipse 整合 jsf+spring2.0+hibernate3.0的问题 MyEclipse6.0 整合 Spring2.0 , Strust2 ,Hibernate3.0 - 情义俩难全 用myeclipse创建spring+hibernate工程时候的jar包冲突问题!!! netbeans6.5开发JSF+Hibernate的一个小例子(原创) JavaScript实现导出为Excel - 情义俩难全 - 博客园 配置 MyEclipse 的 WebLogic 9 服务器 jsp主次数据显示 jsp+javabean实现分页 浅谈“三层结构”原理与用意(转载) MySQL5.0中文问题及JDBC数据库连接和JSP汉字编码问题解决方法总结 用C#生成随机中文汉字验证码的基本原理 ASP.Net+XML打造留言薄 用ASP.NET部署三层架构 - 情义俩难全 - 博客园 .net环境下如何使用MySql数据库(原创) ASP与存储过程 NBSI2内部功能实现大揭谜 存储过程入门与提高
PHPMAIL实例
情义俩难全 · 2011-07-11 · via 博客园 - 情义俩难全

<?php
//引入phpmailer类
require("phpmailer/class.phpmailer.php");

$mail = new PHPMailer();
$address = '9948425@qq.com'; //$_POST['address']; //发件人地址
$mail->IsSMTP();              // set mailer to use SMTP
$mail->Host = "smtp.163.com";     // specify main and backup server (邮局)
$mail->SMTPAuth = true;          // turn on SMTP authentication
$mail->Username = "hal_1983@163.com";   // SMTP username          (用户名)
$mail->Password = "xxxxx";        // SMTP password          (密码)
$mail->From = "hal_1983@163.com"; // 发件人邮箱(如果人家回复的话就是回这个邮箱)
$mail->FromName = "8比特管理员";     // 发件人
$mail->CharSet = "gb2312";         //指定字符集
$mail->Encoding = "base64";        //邮件的编码方式
$mail->AddAddress("$address", "");     //添加收件人邮箱和姓名
//$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 设置邮件格式是HTML
$mail->Subject = "PHPMailer test"; // 邮件主题
// 邮件内容
$mail->Body = '<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=GB2312"></head>
<body>
欢迎来到<a href="http://www.8bits.com">8比特</a> <br /><br />
感谢您注册为本站会员!<br /><br />
</body>
</html> ';
$mail->AltBody ="text/html"; //设置是在邮件正文不支持HTML的备用显示
if(!$mail->Send())
{
 echo "Message could not be sent. <p>";
 echo "Mailer Error: " . $mail->ErrorInfo;
 exit;
}
else
 echo '<script language="javascript">alert("Message has been sent");</script>';
?>