Changeset 15366 for branches/beta
- Timestamp:
- 2007/08/27 16:41:34 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/beta/data/class/GC_SendMail.php
r12216 r15366 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 67 $this->body = mb_convert_encoding( $body, "JIS", CHAR_CODE); 51 68 52 69 // ¥Ø¥Ã¥À¡¼¤ËÆüËܸì¤ò»ÈÍѤ¹¤ë¾ì¹ç¤ÏMb_encode_mimeheader¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£ 53 70 $from_name = ereg_replace("<","¡ã", $from_name); 54 71 $from_name = ereg_replace(">","¡ä", $from_name); 55 $from_name = mb_convert_encoding($from_name,"JIS",CHAR_CODE);56 $this->header = "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n";57 $this->header .= "Reply-To: ". $reply_to . "\n";58 $this->header .= "Cc: " . $cc. "\n";59 $this->header .= "Bcc: " . $bcc . "\n";60 $this->header .= "Errors-To: ". $errors_to ."\n";61 72 62 $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 } 63 97 } 64 65 function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) { 66 67 $this->to = $to; 68 $this->subject = mb_encode_mimeheader($subject); 69 $this->body = mb_convert_encoding( $body, "JIS", CHAR_CODE); 70 $this->header = "Mime-Version: 1.0\n"; 71 $this->header .= "Content-Type: text/html; charset=iso-2022-jp\n"; 72 $this->header .= "Content-Transfer-Encoding: 7bit\n"; 73 $this->header .= "From: ". Mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n"; 74 $this->header .= "Reply-To: ". $reply_to . "\n"; 75 $this->header .= "Cc: " . $cc. "\n"; 76 $this->header .= "Bcc: " . $bcc . "\n"; 77 $this->header .= "Errors-To: ". $errors_to ."\n"; 78 $this->return_path = $return_path; 79 } 80 98 81 99 // ¥á¡¼¥ëÁ÷¿®¤ò¼Â¹Ô¤¹¤ë 82 100 function sendMail() { 83 84 Mb_language( "Japanese" ); 85 86 //¡¡¥á¡¼¥ëÁ÷¿® 87 if( mb_send_mail( $this->to, $this->subject, $this->body, $this->header) ) { 88 return true; 89 } 90 return false; 101 return $this->sendHtmlMail(); 91 102 } 92 103 93 104 function sendHtmlMail() { 94 95 Mb_language( "Japanese" );96 97 105 //¡¡¥á¡¼¥ëÁ÷¿® 98 106 if( mail( $this->to, $this->subject, $this->body, $this->header) ) {
Note: See TracChangeset
for help on using the changeset viewer.