source: branches/comu/data/class/GC_SendMail.php @ 2

Revision 2, 2.9 KB checked in by root, 17 years ago (diff)

new import

Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8//--- ¥Æ¥­¥¹¥È/HTML¡¡¥á¡¼¥ëÁ÷¿®
9class GC_SendMail {
10
11    var $html;          //  HTML ¥á¡¼¥ë¥Ø¥Ã¥À¡¼
12    var $to;            //  Á÷¿®Àè
13    var $subject;       //  Âê̾
14    var $body;          //  ËÜʸ
15    var $header;        //  ¥Ø¥Ã¥À¡¼
16    var $return_path;   //¡¡return path
17    var $mailer;
18
19    /*  ¥Ø¥Ã¥ÀÅù¤ò³ÊǼ
20         $to            -> Á÷¿®Àè¥á¡¼¥ë¥¢¥É¥ì¥¹
21         $subject       -> ¥á¡¼¥ë¤Î¥¿¥¤¥È¥ë
22         $body          -> ¥á¡¼¥ëËÜʸ
23         $fromaddress   -> Á÷¿®¸µ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹
24         $header        -> ¥Ø¥Ã¥À¡¼
25         $from_name     -> Á÷¿®¸µ¤Î̾Á°¡ÊÁ´³ÑOK¡Ë
26         $reply_to      -> reply_toÀßÄê
27         $return_path   -> return-path¥¢¥É¥ì¥¹ÀßÄê¡Ê¥¨¥é¡¼¥á¡¼¥ëÊÖÁ÷ÍÑ¡Ë
28         $cc            -> ¥«¡¼¥Ü¥ó¥³¥Ô¡¼
29         $bcc           -> ¥Ö¥é¥¤¥ó¥É¥«¡¼¥Ü¥ó¥³¥Ô¡¼
30    */ 
31   
32   
33    function setTo($to, $to_name = "") {
34        if($to_name != "") {
35            $name = ereg_replace("<","¡ã", $to_name);
36            $name = ereg_replace(">","¡ä", $name);
37            $name = mb_encode_mimeheader($name);
38            $this->to = $name . "<" . $to . ">";
39        } else {
40            $this->to = $to;
41        }
42    }
43       
44    function setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
45       
46        $this->to            = $to;
47        $this->subject       = $subject;
48        $this->body          = $body;
49        // ¥Ø¥Ã¥À¡¼¤ËÆüËܸì¤ò»ÈÍѤ¹¤ë¾ì¹ç¤ÏMb_encode_mimeheader¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£
50        $from_name = ereg_replace("<","¡ã", $from_name);
51        $from_name = ereg_replace(">","¡ä", $from_name);
52               
53        $this->header        = "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n";
54        $this->header       .= "Reply-To: ". $reply_to . "\n";
55        $this->header       .= "Cc: " . $cc. "\n";
56        $this->header       .= "Bcc: " . $bcc . "\n";
57        $this->header       .= "Errors-To: ". $errors_to ."\n";
58        $this->return_path   = $return_path;
59    }
60
61   
62    function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) {
63           
64        $this->to            = $to;
65        $this->subject       = Mb_encode_mimeheader($subject);
66        $this->body          = mb_convert_encoding( $body, "iso-2022-jp", CHAR_CODE);
67        $this->header        = "Mime-Version: 1.0\n";
68        $this->header       .= "Content-Type: text/html; charset=iso-2022-jp\n";
69        $this->header       .= "Content-Transfer-Encoding: 7bit\n";
70        $this->header       .= "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n";
71        $this->header       .= "Reply-To: ". $reply_to . "\n";
72        $this->header       .= "Cc: " . $cc. "\n";
73        $this->header       .= "Bcc: " . $bcc . "\n";
74        $this->header       .= "Errors-To: ". $errors_to ."\n";
75        $this->return_path   = $return_path;
76    }
77
78    //  ¥á¡¼¥ëÁ÷¿®¤ò¼Â¹Ô¤¹¤ë
79    function sendMail() {
80
81        Mb_language( "Japanese" );
82       
83        //¡¡¥á¡¼¥ëÁ÷¿®
84        if( mb_send_mail( $this->to, $this->subject, $this->body, $this->header, "" . $this->return_path ) ) {
85            return true;
86        }
87        return false;
88    }
89
90    function sendHtmlMail() {
91
92        Mb_language( "Japanese" ); 
93       
94        //¡¡¥á¡¼¥ëÁ÷¿®
95        if( mail( $this->to, $this->subject, $this->body, $this->header, "" . $this->return_path ) ) {
96            return true;
97        }
98        return false;
99    }
100}
101
102?>
Note: See TracBrowser for help on using the repository browser.