| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
|---|
| 4 | * |
|---|
| 5 | * http://www.lockon.co.jp/ |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | //--- ¥Æ¥¥¹¥È/HTML¡¡¥á¡¼¥ëÁ÷¿® |
|---|
| 9 | class 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 | // return_path¤Ï¡¢¥á¡¼¥ë¥Ø¥Ã¥À¡¼¾å¤Ë·Ù¹ð¤¬É½¼¨¤µ¤ì¤ë¤Î¤ÇÍøÍѤ·¤Ê¤¤¡£ |
|---|
| 59 | $return_path = ""; |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) { |
|---|
| 64 | |
|---|
| 65 | $this->to = $to; |
|---|
| 66 | $this->subject = Mb_encode_mimeheader($subject); |
|---|
| 67 | $this->body = mb_convert_encoding( $body, "iso-2022-jp", CHAR_CODE); |
|---|
| 68 | $this->header = "Mime-Version: 1.0\n"; |
|---|
| 69 | $this->header .= "Content-Type: text/html; charset=iso-2022-jp\n"; |
|---|
| 70 | $this->header .= "Content-Transfer-Encoding: 7bit\n"; |
|---|
| 71 | $this->header .= "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n"; |
|---|
| 72 | $this->header .= "Reply-To: ". $reply_to . "\n"; |
|---|
| 73 | $this->header .= "Cc: " . $cc. "\n"; |
|---|
| 74 | $this->header .= "Bcc: " . $bcc . "\n"; |
|---|
| 75 | $this->header .= "Errors-To: ". $errors_to ."\n"; |
|---|
| 76 | // return_path¤Ï¡¢¥á¡¼¥ë¥Ø¥Ã¥À¡¼¾å¤Ë·Ù¹ð¤¬É½¼¨¤µ¤ì¤ë¤Î¤ÇÍøÍѤ·¤Ê¤¤¡£ |
|---|
| 77 | $return_path = ""; |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | // ¥á¡¼¥ëÁ÷¿®¤ò¼Â¹Ô¤¹¤ë |
|---|
| 81 | function sendMail() { |
|---|
| 82 | |
|---|
| 83 | Mb_language( "Japanese" ); |
|---|
| 84 | |
|---|
| 85 | //¡¡¥á¡¼¥ëÁ÷¿® |
|---|
| 86 | if( mb_send_mail( $this->to, $this->subject, $this->body, $this->header) ) { |
|---|
| 87 | return true; |
|---|
| 88 | } |
|---|
| 89 | return false; |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | function sendHtmlMail() { |
|---|
| 93 | |
|---|
| 94 | Mb_language( "Japanese" ); |
|---|
| 95 | |
|---|
| 96 | //¡¡¥á¡¼¥ëÁ÷¿® |
|---|
| 97 | if( mail( $this->to, $this->subject, $this->body, $this->header) ) { |
|---|
| 98 | return true; |
|---|
| 99 | } |
|---|
| 100 | return false; |
|---|
| 101 | } |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | ?> |
|---|