Ignore:
Timestamp:
12/07/10 09:18:31 (13 years ago)
Author:
eduardoalex
Message:

Ticket #1427 - mantendo o encoding e o content type do e-mail original.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php

    r3564 r3566  
    397397                        $head1 = explode(":",$head); 
    398398                        if ( (strtoupper($head1[0]) == "TO") || 
    399                                 (strtoupper($head1[0]) == "FROM") || 
    400                                 (strtoupper($head1[0]) == "SUBJECT") || 
    401                                 (strtoupper($head1[0]) == "DATE") ||  
    402                                 (strtoupper($head1[0]) == "CONTENT-TYPE")) {  
    403  
    404                                         if(strtoupper($head1[0]) == "CONTENT-TYPE"){  
    405                                                 $head = str_replace("multipart/mixed","text/html",$head);                         
    406                                         }  
    407                                         $header .= $head."\n";  
    408                                 }  
     399                                        (strtoupper($head1[0]) == "FROM") || 
     400                                        (strtoupper($head1[0]) == "SUBJECT") || 
     401                                        (strtoupper($head1[0]) == "DATE") ) 
     402                                $header .= $head."\r\n"; 
    409403                } 
    410404 
     
    414408                                                             para que o método decodeBody do expresso possa trazer tudo certinho*/ 
    415409 
     410                $all_body_type = strtolower($msg->file_type[$params["msg_num"]][0]); 
     411                $all_body_encoding = $msg->encoding[$params["msg_num"]][0]; 
     412                $all_body_charset = $msg->charset[$params["msg_num"]][0]; 
     413                 
     414                if($all_body_type=='multipart/alternative') { 
     415                        if(strtolower($msg->file_type[$params["msg_num"]][2]=='text/html') && 
     416                                        $msg->pid[$params["msg_num"]][2] == '1.2') { 
     417                                $body_part_to_show = '1.2'; 
     418                                $all_body_type = strtolower($msg->file_type[$params["msg_num"]][2]); 
     419                                $all_body_encoding = $msg->encoding[$params["msg_num"]][2]; 
     420                                $all_body_charset = $msg->charset[$params["msg_num"]][2]; 
     421                        } 
     422                        else { 
     423                                $body_part_to_show = '1.1'; 
     424                                $all_body_type = strtolower($msg->file_type[$params["msg_num"]][1]); 
     425                                $all_body_encoding = $msg->encoding[$params["msg_num"]][1]; 
     426                                $all_body_charset = $msg->charset[$params["msg_num"]][1]; 
     427                        } 
     428                } 
     429                else 
     430                        $body_part_to_show = '1'; 
     431 
    416432                $status = imap_append($this->mbox, 
    417433                                "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$params["folder"], 
    418434                                        $header. 
     435                                        "Content-Type: ".$all_body_type."; charset = \"".$all_body_charset."\"". 
     436                                        "\r\n". 
     437                                        "Content-Transfer-Encoding: ".$all_body_encoding. 
     438                                        "\r\n". 
    419439                                        "\r\n". 
    420440                                        str_replace("\n","\r\n",$this->decodeBody( 
    421                                                         imap_fetchbody($this->mbox,imap_msgno($this->mbox, $params["msg_num"]),"1"), 
    422                                                         $msg->encoding[$params["msg_num"]][0], $msg->charset[$params["msg_num"]][0] 
     441                                                        imap_fetchbody($this->mbox,imap_msgno($this->mbox, $params["msg_num"]),$body_part_to_show), 
     442                                                        $all_body_encoding, $all_body_charset 
    423443                                                        ) 
    424444                                        ), "\\Seen"); //Append do novo email, só com header e conteúdo sem anexos. 
Note: See TracChangeset for help on using the changeset viewer.