php 发送多个,向多个地址发送邮件的php类
/***
* 多地址发邮件的类
* 示例:
$m = new email ( "hello there", // subject
"how are you?", // message body
"paul", // sender's name
"foo@foobar.com", // sender's email
array("paul@foobar.com", "foo@bar.com"), // To: recipients
"paul@whereever.com" // Cc: recipient
);
print "mail sent, result was" . $m->send();
*/
if ( ! defined( 'MAIL_CLASS_DEFINED' ) ) {
define('MAIL_CLASS_DEFINED', 1 );
class email {
// the constructor!
function email ( $subject, $message, $senderName, $senderEmail, $toList, $ccList=0, $bccList=0, $replyTo=0) {
$this->sender = $senderName . " ";
$this->replyTo = $replyTo;
$this->subject = $subject;
$this->message = $message;
// set the To: recipient(s)
if ( is_array($toList) ) {
$this->to = join( $toList, "," );
} else {
$this->to = $toList;
}
// set the Cc: recipient(s)
if ( is_array($ccList) && sizeof($ccList) ) {
$this->cc = join( $ccList, "," );
} elseif ( $ccList ) {
$this->cc = $ccList;
}
// set the Bcc: recipient(s)
if ( is_array($bccList) && sizeof($bccList) ) {
$this->bcc = join( $bccList, "," );
} elseif ( $bccList ) {
$this->bcc = $bccList;
}
}
// send the message; this is actually just a wrapper for
// PHP's mail() function; heck, it's PHP's mail function done right :-)
// you could override this method to:
// (a) use sendmail directly
// (b) do SMTP with sockets
function send () {
// create the headers needed by PHP's mail() function
// sender
$this->headers = "From: " . $this->sender . "\n";
// reply-to address
if ( $this->replyTo ) {
$this->headers .= "Reply-To: " . $this->replyTo . "\n";
}
// Cc: recipient(s)
if ( $this->cc ) {
$this->headers .= "Cc: " . $this->cc . "\n";
}
// Bcc: recipient(s)
if ( $this->bcc ) {
$this->headers .= "Bcc: " . $this->bcc . "\n";
}
return mail ( $this->to, $this->subject, $this->message, $this->headers );
}
}
}
?>
php 发送多个,向多个地址发送邮件的php类相关推荐
- 使用Java获取发送请求的电脑的IP地址
介绍 客户端所有的请求信息都可以通过HttpServletRequest获得,获取客户端ip可以通过getRemoteAddr()获取. 但是如果客户端是通过代理访问我们的服务器,那么getRemot ...
- python 发送邮件connect none_使用python向IP地址发送邮件
所以我尝试通过python脚本发送邮件.使用通常的接收者地址格式可以正常工作"user@domain.tld". 当我现在尝试使用带有接收者"user@[IP Addre ...
- 【重难点】【计算机网络 01】OSI 七层模型和 TCP/IP 四层模型、IP 地址分为哪几类、ping 的原理、从浏览器地址栏输入 URL 到显示网页的过程、什么是 socket
[重难点][计算机网络 01]OSI 七层模型和 TCP/IP 四层模型.IP 地址分为哪几类.ping 的原理.从浏览器地址栏输入 URL 到显示网页的过程.什么是 socket 文章目录 [重难点 ...
- 构造方法与重载:定义一个网络用户类,信息有用户 ID、用户密码、 email 地址。在建立类的实例时把以上三个信息都作为构造函数的参数输入
构造方法与重载:定义一个网络用户类,信息有用户 ID.用户密码. email 地址.在建立类的实例时把以上三个信息都作为构造函数的参数输入, 其中用户 ID 和用户密码时必须缺省时 email地址是用 ...
- 通过QQ邮箱的SMTP服务器发送QQ邮件至163邮箱提示“发送邮件失败”的解决方案(三种可能性,不妨一试)...
IDE:Visual Studio 2010[C#] + .NET 4.0框架 引用.NET 4.0框架的System.Net.Mail命名空间开发发送邮件的程序.发送方:QQ邮箱 接收方:163邮箱 ...
- 根据地址获取邮编工具类
根据地址获取邮编工具类 import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok. ...
- 计算机 ip 地址分为那几类,ip地址分为几类
ip地址可以分为两类:静态IP地址和动态IP地址.下面我们就来看一下静态IP地址和动态IP地址的具体内容. 静态IP地址 静态IP地址通常不会更改,但可能会因网络管理而更改.它们作为永久的Intern ...
- IP地址分类以及C类IP地址的子网划分
国际规定:把所有的IP地址划分为 A,B,C,D,E A类地址:范围从0-127,0是保留的并且表示所有IP地址,而127也是保留的地址,并且是用于测试环回用的.因此 A类地址的范围其实是从1-126 ...
- 如何更改从Outlook发送的电子邮件中的“答复”地址
If you're sending an email on behalf of someone else, you might want people to reply to that person ...
最新文章
- 承德计算机专业去哪考试,2021河北省考承德都在哪个学校考试?
- POI 2003/2007 下拉列表
- php 二维sort,php 二维数组排序
- 选择省份时,自动显示对应省份的城市
- shell如何传参?
- 通达信公式大全_通达信选股器公式大全:抓牛股、抓妖股、找龙头,一应俱全...
- SVN客户端使用详细
- 我要彻底搞懂SSD网络结构(2)特征提取网络
- 如何在vue项目中使用styl
- Win10连接上了wifi但是打开浏览器显示网络异常,诊断网络发现错误“远程计算机或者设备将不接受连接
- 关于javaweb中的流媒体
- 阿里云——弹性公网IP
- python订单管理系统功能_后台系统:订单管理
- 从0开始学SLAM的各种问题
- Android制作.9图
- CAD基础+常用快捷(三)
- WARN o.m.s.m.ClassPathMapperScanner - [warn,44] - No MyBatis mapper was found in ‘[com.ruoyi.**.map
- 190606-190610《跟秋叶学PPT》
- 一个 Android MVVM 组件化架构框架
- ap计算机科学课程内容,AP课程之“计算机科学原理”介绍
热门文章
- Python中的可变与不可变对象
- 天然纤维复合材料行业调研报告 - 市场现状分析与发展前景预测
- 急性中耳炎的治疗行业调研报告 - 市场现状分析与发展前景预测
- 2021年中国电力线通信(PLC)市场趋势报告、技术动态创新及2027年市场预测
- linux 内核模块 proc,Linux 内核模块 proc文件系统.pdf
- Raspberry Pi 的新用法:检测家中的漏水情况
- 程序员不应该“躺平”
- Oracle 的成功无法复制,国产数据库该如何突破?
- Linus:“免费”不是最重要的,“源代码公开”才是,Linux 30岁生日快乐!
- 京东被曝显卡售后不肯维修要原价退款;​IBM发布第一个2纳米芯片;Bootstrap 5.0.0发布|极客头条...