Changeset 15148 for branches/dev


Ignore:
Timestamp:
2007/07/31 21:12:29 (17 years ago)
Author:
naka
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dev/data/class/GC_SendMail.php

    r14873 r15148  
    2929         $bcc           -> ¥Ö¥é¥¤¥ó¥É¥«¡¼¥Ü¥ó¥³¥Ô¡¼ 
    3030    */   
    31      
    32      
    3331    function setTo($to, $to_name = "") { 
    3432        if($to_name != "") { 
     
    4139        } 
    4240    } 
     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    } 
    4348         
    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 ="" ) { 
    4557         
    4658        $this->to            = $to; 
    47         $this->subject       = $subject; 
     59        $this->subject       = mb_encode_mimeheader($subject); 
    4860 
    4961        // iso-2022-jp¤À¤ÈÆüìʸ»ú¤¬¡©¤ÇÁ÷¿®¤µ¤ì¤ë¤Î¤ÇJIS¤ò»ÈÍѤ¹¤ë¡£ 
    5062        $this->body          = mb_convert_encoding( $body, "JIS", CHAR_CODE); 
    51  
     63        //$this->body            = $body; 
     64                 
    5265        // ¥Ø¥Ã¥À¡¼¤ËÆüËܸì¤ò»ÈÍѤ¹¤ë¾ì¹ç¤ÏMb_encode_mimeheader¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£ 
    5366        $from_name = ereg_replace("<","¡ã", $from_name); 
    5467        $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); 
    6169         
    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        } 
    6389    } 
    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     
    8191    //  ¥á¡¼¥ëÁ÷¿®¤ò¼Â¹Ô¤¹¤ë 
    8292    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(); 
    9194    } 
    9295 
    9396    function sendHtmlMail() { 
    94  
    95         Mb_language( "Japanese" );   
    96          
    9797        //¡¡¥á¡¼¥ëÁ÷¿® 
    9898        if( mail( $this->to, $this->subject, $this->body, $this->header) ) { 
Note: See TracChangeset for help on using the changeset viewer.