sample as below:

require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); $body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body); $mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "mail.yourdomain.com"; // sets the SMTP server
$mail->Port = 26; // set the SMTP port for the GMAIL server
$mail->Username = "yourname@yourdomain"; // SMTP account username
$mail->Password = "yourpassword"; // SMTP account password $mail->SetFrom('name@yourdomain.com', 'First Last'); $mail->AddReplyTo("name@yourdomain.com","First Last"); $mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe"); $mail->AddAttachment("images/phpmailer.gif"); // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

最新文章

  1. BIT 树状数组 详解 及 例题
  2. JavaScript中数组去除重复
  3. Android应用开发-数据存储和界面展现(一)(重制版)
  4. [置顶] 两台一级域名相同二级域名不同的服务器,怎么共享session
  5. Yii2 富头像上传
  6. MVC 分页获取数据 及点选按钮
  7. CC++初学者编程教程(11) 配置Windows数据库服务器
  8. python函数abs()
  9. [转]View属性 之 paddingStart & paddingEnd
  10. &#65279导致网页顶部空白一行的解决办法【实测有效】
  11. python 逻辑运算符问题
  12. KO ----- 静态资源404问题
  13. C代码快速构建框架
  14. 【python001-IDLE】
  15. Bootstarp 模版网站
  16. 1-100求和 sum(range(101))
  17. Hive,HANA可视化客户端工具
  18. win 10 文件夹 背景 没效果
  19. 《转》深入理解Activity启动流程(三)–Activity启动的详细流程2
  20. 【BZOJ1494】【NOI2007】生成树计数(动态规划,矩阵快速幂)

热门文章

  1. ThreadPoolExecutor执行任务,异常日志缺失问题
  2. 2019 ICPC南京网络预选赛 I Washing clothes 李超线段树
  3. HDU - 4305 - Lightning 生成树计数 + 叉积判断三点共线
  4. 拿 C# 搞函数式编程 - 1
  5. 【LeetCode】103# 二叉树的锯齿形层次遍历
  6. Java IO写文件效率
  7. [1]尝试用Unity3d制作一个王者荣耀(持续更新)->AssetBundle管理器
  8. FreeSql (四)实体特性 Fluent Api
  9. Zookeeper系列一:Zookeeper基础命令操作
  10. .Net基础篇_学习笔记_第八天_复杂数据类型(常量/枚举/结构)