国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > 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}  
}  


}  
?>  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 花莲县| 公主岭市| 炎陵县| 南陵县| 三亚市| 邢台县| 莎车县| 临湘市| 澄迈县| 保康县| 华阴市| 分宜县| 青浦区| 高邑县| 龙州县| 景泰县| 安新县| 大丰市| 肇源县| 乌恰县| 梅河口市| 正宁县| 甘谷县| 山西省| 海阳市| 十堰市| 施秉县| 佳木斯市| 徐州市| 军事| 深水埗区| 渝北区| 信宜市| 确山县| 阿鲁科尔沁旗| 揭阳市| 余庆县| 柯坪县| 南陵县| 马边| 得荣县|