php怎么添加多个邮件地址,PHP_给多个地址发邮件的类,<?php ////////////////////////////// - phpStudy...

给多个地址发邮件的类

// EmailClass 0.5

// class for sending mail

//

// Paul Schreiber

// php@paulschreiber.com

// http://paulschreiber.com/

//

// parameters

// ----------

// - subject, message, senderName, senderEmail and toList are required

// - ccList, bccList and replyTo are optional

// - toList, ccList and bccList can be strings or arrays of strings

// (those strings should be valid email addresses

//

// example

// -------

// $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 );

}

}

}

?>相关阅读:

Apache服务器学习--PHP应用精彩图解

javascript整除实现代码

PHP+MYSQL动态网页编程纠错指南

下载网站打开页面后间隔多少时间才显示下载链接地址的代码

Linux系统上一个功能较全的Squid配置文件

利用缓冲技术提高JSP程序的性能和稳定性

初窥JQuery-Jquery简介 入门了解篇

一款Jquery 分页插件的改造方法(服务器端分页)

prototype 1.5相关知识及他人笔记

系统备份与恢复技巧 Ghost程序参数四则

解决表单中第一个非隐藏的元素获得焦点的一个方案

在Linux下删除不安全telnet

VBS教程:函数-DateAdd 函数

一定时间滚动的链接菜单效果

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值