phpmailer邮件类
<?php
/**
* 邮件类
* Enter description here ...
* @author df
* Mail::getMail()->sendMail();
*
*/
class Mail{
private static $__mail=null;//邮箱类对象
private $__PMAIL=NULL;
function __construct(){
require('class.phpmailer.php');
$this->__PMAIL=new PHPMailer();
$this->__PMAIL->IsSMTP();
$this->__PMAIL->Host= "smtp.163.com";
$this->__PMAIL->Username="";
$this->__PMAIL->Password="";
$this->__PMAIL->SMTPAuth=true;
$this->__PMAIL->From="";
}
public static function getMail(){
/*if(!self::$__mail){
self::$__mail=new Mail();
}
return self::$__mail;
*/
return new Mail();
}
/**
*
* Enter description here ...
* @param unknown_type $toAddress //收件人地址,多个可用,好分隔
* @param unknown_type $fromName //发件人名字
* @param unknown_type $title //标题
* @param unknown_type $content //内容
* @param unknown_type $isHTML //是否以HTML格式发送
* @param unknown_type $charset //编码
* @param unknown_type $replyto //收件人地址
* @param unknown_type $attachment //附件
*/
function sendMail($toAddress,$title='',$content='',$isHTML=TRUE,$charset='utf-8',$replyto='',$fromName='',$attachment=''){
$this->__PMAIL->IsHTML($isHTML);
$this->__PMAIL->CharSet=$charset;
if(strstr($toAddress,',')){
$__list=explode(',', $toAddress);
foreach ($__list as $v){
$this->__PMAIL->AddAddress($v,$v);
}
}else{
$this->__PMAIL->AddAddress($toAddress,$toAddress);
}
$this->__PMAIL->FromName=$fromName;
$this->__PMAIL->Subject=$title;
$this->__PMAIL->Body=$content;
if($replyto){
$this->__PMAIL->AddReplyTo($replyto);
}
if($attachment){
$this->__PMAIL->AddAttachment($attachment,$attachment);
}
return $this->__PMAIL->Send();
}
}
phpmailer邮件类的更多相关文章
- PHPMailer邮件类使用错误分析
PHPMailer配置清单如下: require_once ‘class.phpmailer.php‘; $receiver = ”; $mail = new PHPMailer ( ); $mai ...
- php使用PHPMailer邮件类发送邮件
PHPMailer是一个用于发送电子邮件的PHP函数包.它提供的功能包括:*.在发送邮时指定多个收件人,抄送地址,暗送地址和回复地址*.支持多种邮件编码包括:8bit,base64,binary和qu ...
- phpmailer邮件类下载(转)
PHPMailer是一个用于发送电子邮件的PHP函数包.它提供的功能包括:*.在发送邮时指定多个收件人,抄送地址,暗送地址和回复地址*.支持多种邮件编码包括:8bit,base64,binary和qu ...
- ThinkPHP中使用PHPMailer邮件类
第一步.添加PHPMailer类库将下载后的文件解压,将PHPMail目录移动至ThinkPHP目录中的Vendor内.(请确保class.phpmailer.php文件就在ThinkPHP\Vend ...
- 关于 PHPMailer 邮件发送类的使用心得(含多文件上传)
This is important for send mail PHPMailer 核心文件 class.phpmailer.php class.phpmaileroauth.php class.ph ...
- tp3.2 新增邮件类
1.新建方法 调用发送邮件,我的目录在/admin下 2.新增邮件方法 类的发送配置功能 文件地址: 网站根目录\项目目录\Admin\Common\ 文件 名 :function.php ...
- Android调用系统邮件类应用的正确实现方法
Android应用开发中,很多情况下免不了要调用手机上的邮件类应用,实现邮件发送的功能,这一般是通过调用系统已有的Intent来实现的.看到网上很多邮件发送都是调用action为android.con ...
- c++封装的发邮件类CSendMail
项目需要做发邮件的功能,在网上找了一下代码,比较出名的SMailer编译不过(把那个Base64的encode拉到MailSender中实现就能过,但我搞不懂原来出错的原因,就不想用),另外找到了一个 ...
- phpMailer邮件发送
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
随机推荐
- 2017.11.15 Add a parameter –serial <serial no> to the Target field.
1 exe创建快捷方式,并且加后缀 program --serial 50114130 这是Win里面的一种调用说明. Please note that the programming logs ...
- poscms仿站知识点总结(二)
1.相同类型div添加不同class 遇到一个样式上的问题,模板页面有8个子项,样式都是一样,至于数据是可以用for循环来添加的,但是for循环的时候,每个div的 类名是无法及时更改的,但是模板页面 ...
- Drools7.0.0.Final Unsupported major.minor version 52.0异常
异常信息 在使用Drools7.0.0.Final版本进行开发过程中,出现以下异常: java.lang.UnsupportedClassVersionError: org/kie/api/KieSe ...
- React Native探索(四)Flexbox布局详解
相关文章 React Native探索系列 前言 在Android开发中我们有很多种布局,比如LinearLayout和RelativeLayout,同样在React Native也有它的布局,这个布 ...
- matlab批量转化img到gray
path = 'D:\宝贝儿数据集\COIL-3D\coil-100\'; save_path = 'D:\宝贝儿数据集\COIL-3D\coil-100-gray\'; file=dir([path ...
- css3单冒号和双冒号的区别
css3中对于伪元素的使用,在项目开发中使用得当将会对代码的可读性又很大的提升.但是对于伪类大家或许都知道是一些选择器的使用,这里总结了关于伪元素中单冒号和双冒号的区别: 再官方定义中规定单冒号都为伪 ...
- hexo配置主题发表文章
将本地hexo博客部署到github上了,如果想换我们自己喜欢的主题(默认为landscape),同时也要发表发表文章呢,下面给介绍下: 1,进入hexo官网,预览自己想要的主题,https://gi ...
- homebrew的安装与使用
homebrew的安装:http://jingyan.baidu.com/article/fec7a1e5ec30341190b4e7e5.html 引用segfaultment上面的回答 没这个说法 ...
- 转 OpenFaaS 介绍
来源: https://thenewstack.io/openfaas-put-serverless-function-container/?utm_source=tuicool&utm_me ...
- 最长的回文串——hdu3068
http://acm.hdu.edu.cn/showproblem.php?pid=3068 abcba 5 aab 2 在一个字符串里寻找一条最长的回文串 比较直接的想法是枚举中心点 然后像两边扩散 ...