- Timestamp:
- 2007/08/01 23:44:48 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-paygent/data/class/GC_SendMail.php
r15146 r15162 17 17 var $mailer; 18 18 19 function setTo($to, $to_name = "") { 20 if($to_name != "") { 21 $name = ereg_replace("<","¡ã", $to_name); 22 $name = ereg_replace(">","¡ä", $name); 23 24 if(WINDOWS != true) { 25 // windows¤Ç¤Ïʸ»ú²½¤±¤¹¤ë¤Î¤Ç»ÈÍѤ·¤Ê¤¤¡£ 26 $name = mb_convert_encoding($name,"JIS",CHAR_CODE); 27 } 28 29 $name = mb_encode_mimeheader($name); 30 $this->to = $name . "<" . $to . ">"; 31 } else { 32 $this->to = $to; 33 } 34 } 35 36 function setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) { 37 $this->header = "Mime-Version: 1.0\n"; 38 $this->header .= "Content-Type: text/plain; charset=ISO-2022-JP\n"; 39 $this->header .= "Content-Transfer-Encoding: 7bit\n"; 40 $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc); 41 } 42 43 function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) { 44 $this->header = "Mime-Version: 1.0\n"; 45 $this->header .= "Content-Type: text/html; charset=ISO-2022-JP\n"; 46 $this->header .= "Content-Transfer-Encoding: 7bit\n"; 47 $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc); 48 } 49 19 50 /* ¥Ø¥Ã¥ÀÅù¤ò³ÊǼ 20 51 $to -> Á÷¿®Àè¥á¡¼¥ë¥¢¥É¥ì¥¹ … … 28 59 $cc -> ¥«¡¼¥Ü¥ó¥³¥Ô¡¼ 29 60 $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(mb_convert_encoding($name, "JIS", CHAR_CODE)); 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 61 */ 62 function setBase( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) { 46 63 $this->to = $to; 47 $this->subject = $subject;64 $this->subject = mb_encode_mimeheader($subject); 48 65 49 66 // iso-2022-jp¤À¤ÈÆÃ¼ìʸ»ú¤¬¡©¤ÇÁ÷¿®¤µ¤ì¤ë¤Î¤ÇJIS¤ò»ÈÍѤ¹¤ë¡£ 50 //$this->body = mb_convert_encoding( $body, "JIS", CHAR_CODE); 51 $this->body = $body; 52 53 67 $this->body = mb_convert_encoding( $body, "JIS", CHAR_CODE); 68 54 69 // ¥Ø¥Ã¥À¡¼¤ËÆüËܸì¤ò»ÈÍѤ¹¤ë¾ì¹ç¤ÏMb_encode_mimeheader¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£ 55 70 $from_name = ereg_replace("<","¡ã", $from_name); 56 71 $from_name = ereg_replace(">","¡ä", $from_name); 57 $from_name = mb_convert_encoding($from_name,"JIS",CHAR_CODE);58 $this->header = "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n";59 $this->header .= "Reply-To: ". $reply_to . "\n";60 $this->header .= "Cc: " . $cc. "\n";61 $this->header .= "Bcc: " . $bcc . "\n";62 $this->header .= "Errors-To: ". $errors_to ."\n";63 72 64 $this->return_path = $return_path; 73 if(WINDOWS != true) { 74 // windows¤Ç¤Ïʸ»ú²½¤±¤¹¤ë¤Î¤Ç»ÈÍѤ·¤Ê¤¤¡£ 75 $from_name = mb_convert_encoding($from_name,"JIS",CHAR_CODE); 76 } 77 78 $this->header.= "From: ". mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n"; 79 80 if($reply_to != "") { 81 $this->header.= "Reply-To: ". $reply_to . "\n"; 82 } else { 83 $this->header.= "Reply-To: ". $fromaddress . "\n"; 84 } 85 86 if($cc != "") { 87 $this->header.= "Cc: " . $cc. "\n"; 88 } 89 90 if($bcc != "") { 91 $this->header.= "Bcc: " . $bcc . "\n"; 92 } 93 94 if($errors_to != "") { 95 $this->header.= "Errors-To: ". $errors_to ."\n"; 96 } 65 97 } 66 67 function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) { 68 69 $this->to = $to; 70 $this->subject = mb_encode_mimeheader($subject); 71 $this->body = mb_convert_encoding( $body, "JIS", CHAR_CODE); 72 $this->header = "Mime-Version: 1.0\n"; 73 $this->header .= "Content-Type: text/html; charset=iso-2022-jp\n"; 74 $this->header .= "Content-Transfer-Encoding: 7bit\n"; 75 $this->header .= "From: ". mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n"; 76 $this->header .= "Reply-To: ". $reply_to . "\n"; 77 $this->header .= "Cc: " . $cc. "\n"; 78 $this->header .= "Bcc: " . $bcc . "\n"; 79 $this->header .= "Errors-To: ". $errors_to ."\n"; 80 $this->return_path = $return_path; 81 } 82 98 83 99 // ¥á¡¼¥ëÁ÷¿®¤ò¼Â¹Ô¤¹¤ë 84 100 function sendMail() { 85 86 Mb_language( "Japanese" ); 87 88 //¡¡¥á¡¼¥ëÁ÷¿® 89 if( mb_send_mail( $this->to, $this->subject, $this->body, $this->header) ) { 90 return true; 91 } 92 return false; 101 return $this->sendHtmlMail(); 93 102 } 94 103 95 104 function sendHtmlMail() { 96 97 Mb_language( "Japanese" );98 99 105 //¡¡¥á¡¼¥ëÁ÷¿® 100 106 if( mail( $this->to, $this->subject, $this->body, $this->header) ) {
Note: See TracChangeset
for help on using the changeset viewer.
