source: temp/trunk/data/class/GC_SendMail.php @ 1328

Revision 1328, 2.8 KB checked in by naka, 20 years ago (diff)

* empty log message *

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