首页 >> 读书频道 >> 电脑 >> 给多个地址发邮件的类
 
· 通过文字传递创建的图形按
· 一个SQL管理员的web
· 用PHP产生动态的影像图
· php访问查询mysql
· 一个高ai的分页函数和一
· 如何实现给定日期的若干天
· 复杂检索数据并分页显示的
· PHP+Javascri
· PHP与Javascri
· 用session做客户验
· 对Javascript和
· 用php和MySql来与
 
· 美容养颜手册
· 加油金顺剧情分集介绍完整
· 红楼梦:120回全本[清
· 素质教育在美国
· 全唐诗卷四十六
· 韩剧《布拉格恋人》剧情介
· 夜航船[作者:明·张岱]
· 局外人[作者:韩·可爱淘
· 现场流行病学
· 源氏物语[日本:紫式部]
· 武林寓言故事
· 2006高考录取规则
 
· (出租)中动商场部分及写
· (出租)中动动漫基地&#
· 喜剧学院
· 《善德女王》剧情介绍
· 魔女18号 剧情
· 丑女无敌剧情介绍
· 魔女幼熙剧情介绍
· 龙游天下剧情介绍
· 震撼世界的七日剧情介绍
· 静静的白桦林剧情介绍
· 心情日记—老公今天我想对
· 旗舰剧情介绍
欢迎来到月影社区!如果您觉得这里不错,请推荐给您的朋友们。月影社区:http://wf66.com/

给多个地址发邮件的类


查看有无更新版本

关键字:PHP 2006-9-4

 

<?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",            // 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 . " <$senderEmail>"; 
                $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 ); 
        } 



?> 

给多个地址发邮件的类

[ 1 ]
给多个地址发邮件的类 num

打印本页 关闭

关于我们版权声明本站导航友情连结作品演示 TOP↑