Changeset 15148 for branches/dev
- Timestamp:
- 2007/07/31 21:12:29 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/dev/data/class/GC_SendMail.php
r14873 r15148 29 29 $bcc -> ¥Ö¥é¥¤¥ó¥É¥«¡¼¥Ü¥ó¥³¥Ô¡¼ 30 30 */ 31 32 33 31 function setTo($to, $to_name = "") { 34 32 if($to_name != "") { … … 41 39 } 42 40 } 41 42 function setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) { 43 $this->header = "Mime-Version: 1.0\n"; 44 $this->header .= "Content-Type: text/plain; charset=ISO-2022-JP\n"; 45 $this->header .= "Content-Transfer-Encoding: 7bit\n"; 46 $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc); 47 } 43 48 44 function setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to="", $bcc="", $cc ="" ) { 49 function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) { 50 $this->header = "Mime-Version: 1.0\n"; 51 $this->header .= "Content-Type: text/html; charset=ISO-2022-JP\n"; 52 $this->header .= "Content-Transfer-Encoding: 7bit\n"; 53 $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc); 54 } 55 56 function setBase( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) { 45 57 46 58 $this->to = $to; 47 $this->subject = $subject;59 $this->subject = mb_encode_mimeheader($subject); 48 60 49 61 // iso-2022-jp¤À¤ÈÆÃ¼ìʸ»ú¤¬¡©¤ÇÁ÷¿®¤µ¤ì¤ë¤Î¤ÇJIS¤ò»ÈÍѤ¹¤ë¡£ 50 62 $this->body = mb_convert_encoding( $body, "JIS", CHAR_CODE); 51 63 //$this->body = $body; 64 52 65 // ¥Ø¥Ã¥À¡¼¤ËÆüËܸì¤ò»ÈÍѤ¹¤ë¾ì¹ç¤ÏMb_encode_mimeheader¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£ 53 66 $from_name = ereg_replace("<","¡ã", $from_name); 54 67 $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"; 68 $from_name = mb_convert_encoding($from_name,"JIS",CHAR_CODE); 61 69 62 $this->return_path = $return_path; 70 $this->header.= "From: ". mb_encode_mimeheader( $from_name )."<".$fromaddress.">\n"; 71 72 if($reply_to != "") { 73 $this->header.= "Reply-To: ". $reply_to . "\n"; 74 } else { 75 $this->header.= "Reply-To: ". $fromaddress . "\n"; 76 } 77 78 if($cc != "") { 79 $this->header.= "Cc: " . $cc. "\n"; 80 } 81 82 if($bcc != "") { 83 $this->header.= "Bcc: " . $bcc . "\n"; 84 } 85 86 if($errors_to != "") { 87 $this->header.= "Errors-To: ". $errors_to ."\n"; 88 } 63 89 } 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 90 81 91 // ¥á¡¼¥ëÁ÷¿®¤ò¼Â¹Ô¤¹¤ë 82 92 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; 93 return $this->sendHtmlMail(); 91 94 } 92 95 93 96 function sendHtmlMail() { 94 95 Mb_language( "Japanese" );96 97 97 //¡¡¥á¡¼¥ëÁ÷¿® 98 98 if( mail( $this->to, $this->subject, $this->body, $this->header) ) {
Note: See TracChangeset
for help on using the changeset viewer.