a亚洲精品_精品国产91乱码一区二区三区_亚洲精品在线免费观看视频_欧美日韩亚洲国产综合_久久久久久久久久久成人_在线区

首頁 > 編程 > PHP > 正文

給多個地址發郵件的類

2019-09-08 23:11:51
字體:
來源:轉載
供稿:網友
<?php  

////////////////////////////////////////////////////////////  
//   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",/t    // subject  
///t/t    "how are you?",/t   // message body  
///t/t    "paul",/t/t   // sender's name  
///t/t    "foo@foobar.com",/t // sender's email  
///t/t    array("paul@foobar.com", "foo@bar.com"), // To: recipients  
///t/t    "paul@whereever.com"      // Cc: recipient  
///t/t   );  
//  
//       print "mail sent, result was" . $m->send();  
//  
//  
//  

if ( ! defined( 'MAIL_CLASS_DEFINED' ) ) {  
/tdefine('MAIL_CLASS_DEFINED', 1 );  

class email {  

/t// the constructor!  
/tfunction email ( $subject, $message, $senderName, $senderEmail, $toList, $ccList=0, $bccList=0, $replyTo=0) {  
/t/t$this->sender = $senderName . " <$senderEmail>";  
/t/t$this->replyTo = $replyTo;  
/t/t$this->subject = $subject;  
/t/t$this->message = $message;  

/t/t// set the To: recipient(s)  
/t/tif ( is_array($toList) ) {  
/t/t/t$this->to = join( $toList, "," );  
/t/t} else {  
/t/t/t$this->to = $toList;  
/t/t}  

/t/t// set the Cc: recipient(s)  
/t/tif ( is_array($ccList) && sizeof($ccList) ) {  
/t/t/t$this->cc = join( $ccList, "," );  
/t/t} elseif ( $ccList ) {  
/t/t/t$this->cc = $ccList;  
/t/t}  
/t/t  
/t/t// set the Bcc: recipient(s)  
/t/tif ( is_array($bccList) && sizeof($bccList) ) {  
/t/t/t$this->bcc = join( $bccList, "," );  
/t/t} elseif ( $bccList ) {  
/t/t/t$this->bcc = $bccList;  
/t/t}  

/t}  

/t// send the message; this is actually just a wrapper for  
/t// PHP's mail() function; heck, it's PHP's mail function done right :-)  
/t// you could override this method to:  
/t// (a) use sendmail directly  
/t// (b) do SMTP with sockets  
/tfunction send () {  
/t/t// create the headers needed by PHP's mail() function  

/t/t// sender  
/t/t$this->headers = "From: " . $this->sender . "/n";  

/t/t// reply-to address  
/t/tif ( $this->replyTo ) {  
/t/t/t$this->headers .= "Reply-To: " . $this->replyTo . "/n";  
/t/t}  

/t/t// Cc: recipient(s)  
/t/tif ( $this->cc ) {  
/t/t/t$this->headers .= "Cc: " . $this->cc . "/n";  
/t/t}  

/t/t// Bcc: recipient(s)  
/t/tif ( $this->bcc ) {  
/t/t/t$this->headers .= "Bcc: " . $this->bcc . "/n";  
/t/t}  
/t  
/t/treturn mail ( $this->to, $this->subject, $this->message, $this->headers );  
/t}  
}  


}  
?>  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 粉嫩高清一区二区三区精品视频 | 欧洲国产伦久久久久久久 | 精品美女在线 | 亚洲日本精品一区二区三区 | 免费黄色小片 | 亚洲视频一区二区三区 | 国产大奶视频 | 一级毛片免费播放 | 国产视频自拍一区 | 97国产精品视频人人做人人爱 | 国产香蕉视频在线播放 | 久久之精品 | 中文字幕不卡在线88 | 亚洲第一区国产精品 | av四虎 | 97成人超碰| 精品久 | 青青草一区二区 | 国产精品视频一区二区三区 | 精品国产一区一区二区三亚瑟 | 午夜私人影院在线观看 | 久久久久久久网 | 亚洲国产一区二区三区在线观看 | 久久国产成人 | 亚洲 精品 综合 精品 自拍 | 天天干夜夜操 | 国产一区二区在线免费观看 | 欧美三区视频 | 欧美一级久久 | 久久久tv | 中文字幕在线看片 | 国产免费自拍 | 羞羞视频官网 | 国产极品美女在线播放 | 欧美午夜理伦三级在线观看 | 国产一区 | 91在线精品秘密一区二区 | 电影91久久久 | 亚洲视频综合 | 国产不卡视频在线观看 | 97国产一区二区精品久久呦 |