Basic Example using SMTP (for PHPMailer v5.0.0 and up)
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!";
}
Basic Example using SMTP (for PHPMailer v5.0.0 and up)的更多相关文章
- Jexus V5.8.0正式发布:跨平台的ASP.NET WEB服务器
Jexus Web Server V5.8.0 已于今日(12月10日)正式发布,下载地址:http://www.linuxdot.net/. Jexus v5.8.0有如下的更新: 1,为反向代理增 ...
- FineUIPro/Mvc/Core v5.4.0即将发布(Core基础版,新功能列表)!
FineUIPro/Mvc/Core v5.4.0 即将于 2019-03-04 发布,目前官网示例已更新,先睹为快:http://pro.fineui.com/http://mvc.fineui.c ...
- FineUIPro v5.2.0已发布(jQuery升级,自定义图标,日期控件)
FineUIPro/MVC/Core/JS v5.2.0 已经于 2018-8-20 发布,官网示例已更新,如果大家在测试中发现任何问题,请回复本帖,谢谢了. 在线示例: FineUI Pro:htt ...
- FineUIPro v5.1.0 发布了!
FineUIPro v5.1.0 已发布,这已经是自 2014 年以来的第 31 个版本,4 年来精雕细琢,只为你来! 上个大版本新增了响应式布局,而这个版本主要是BUG修正,此外还增加了树控件的级联 ...
- 【Win7 x64】+【annaconda3】+ 【python3.5.2】+【tensorflow-gpu】 [最终配置 gtx 940mx + Cuda8.0+cudnn v5.1 + tensorflow-gpu1.0.0 ]
1.安装cuda Toolkit 和cudnn (百度云可下载,版本需要对应) 2.配置环境变量: 3.安装cudnn(需要拷贝一些dll和lib来进行配置) 4.进入cmd,找到anaconda3的 ...
- hdcms v5.7.0学习笔记
hdcms v5.7.0学习笔记 https://note.youdao.com/ynoteshare1/index.html?id=c404d63ac910eb15a440452f73d6a6db& ...
- 创建1M-1T的虚拟磁盘(内存盘)——使用破解版 Primo Ramdisk Server Edition v5.6.0
破解版 Primo Ramdisk Server Edition v5.6.0下载: https://pan.lanzou.com/i0sgcne 步骤: 下载并解压后安装“Primo.Ramdisk ...
- Java 开源办公开发平台 O2OA V5.4.0 发布 | 设计元素搜索功能上线
O2OA V5.4.0版本此次更新的设计元素搜索功能,可以让用户在海量的脚本.页面.表单.视图等信息中迅速锁定有价值的信息,以便提高用户获取信息的效率.拥有此搜索功能后,在开发过程中,可以加速定位脚本 ...
- c basic library framework - simplec 2.0.0
前言 - simplec 单元测试 流程介绍 一个关于C基础库 simplec 2.0.0 发布了. 详细的文档介绍请参照 README.md. 说的再多都无用, 抵不上 gdb 一个 b r n. ...
随机推荐
- 在.net core web 项目中操作MySql数据库(非ORM框架,原生sql语句方式)
本案例通过MySql.Data和Dapper包执行原生sql,实现对数据库的操作. 操作步骤: 第1步:在MySql数据库中新建表User(使用Navicat For MySql工具) 建表语句: c ...
- mysql中的分组统计函数及其用法实例
1.使用group by对数据进行分组:select 字段名... from tablename group by 字段名...:可以把分组.排序.统计等等都结合在一起使用,实际应用中也多是这样的: ...
- 用java实现取1-100之间的99个不重复的随机数 然后输出没有被取出的数字
package cn.kgc.springtest2.demo1.dao; import java.util.BitSet; /** * @author * @create 2019-08-02 17 ...
- CF1036C Classy Numbers dfs+二分
Classy Numbers time limit per test 3 seconds memory limit per test 256 megabytes input standard inpu ...
- HDU 1018 Big Number 斯特林公式
Big Number 题意:算n!的位数. 题解:对于一个数来算位数我们一般都是用while去进行计算,但是n!这个数太大了,我们做不到先算出来在去用while算位数. while(a){ cnt++ ...
- codeforces 459 E. Pashmak and Graph(dp)
题目链接:http://codeforces.com/contest/459/problem/E 题意:给出m条边n个点每条边都有权值问如果两边能够相连的条件是边权值是严格递增的话,最长能接几条边. ...
- 2、pytest中文文档--使用和调用
目录 使用和调用 通过python -m pytest调用pytest *pytest执行结束时返回的状态码 pytest命令执行结束,可能会返回以下六种状态码: *获取帮助信息 最多允许失败的测试用 ...
- zabbix监控nginx脚本
~]# cd /etc/zabbix/scripts/ scripts]# ls nginx_status.sh scripts]# cat nginx_status.sh ############# ...
- Maven项目使用Nexus作为远程仓库的settings.xml配置
Maven项目使用Nexus作为远程仓库的settings.xml配置(转) 在自己电脑C:\Users\hanmm\.m2\下的setting.xml. 1.服务器配置 <server> ...
- C# Post Get 方式发送请求
httpPost 方式发送请求 不带参数 /// <summary> /// 没有参数的post请求 /// </summary> public void HttpPostNo ...