Changeset 2905


Ignore:
Timestamp:
06/08/10 15:48:01 (14 years ago)
Author:
amuller
Message:

Ticket #737 - Arrumando flags de desanexar e outros campos do header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r2853 r2905  
    373373                $header = ""; 
    374374 
    375                 $headertemp = explode("\n",imap_fetchheader($this->mbox, imap_msgno($this->mbox, $params["msg_num"]))); 
    376                 foreach($headertemp as $head) {//Se eu colocar todo o header do email dá pau no append, então procuro apenas o que interessa. 
    377                 $head1 = explode(":",$head); 
    378                         if ( (strtoupper($head1[0]) == "TO") ||  
    379                                         (strtoupper($head1[0]) == "FROM") ||  
    380                                         (strtoupper($head1[0]) == "SUBJECT") || 
    381                                         (strtoupper($head1[0]) == "DATE") || 
    382                                         (strtoupper($head1[0]) == "CONTENT-TYPE")) { 
    383                                          
    384                                 if(strtoupper($head1[0]) == "CONTENT-TYPE"){ 
    385                                         $head = str_replace("multipart/mixed","text/html",$head); 
    386                                 } 
    387                                 $header .= $head."\n"; 
    388                         } 
    389                 } 
     375                $headertemp = imap_headerinfo($this->mbox, imap_msgno($this->mbox, $params["msg_num"])); 
     376                $header = "Date: ".$headertemp->date . "\r\n"; 
     377                $header .= "To: ".$headertemp->toaddress . "\r\n"; 
     378                $header .= "From: ".$headertemp->fromaddress . "\r\n"; 
     379                $header .= "X-Expresso-Modified: ".date("F j, Y, g:i a"). "\r\n"; 
     380                $header .= "Cc: ".$headertemp->ccaddress."\r\n"; 
     381                $header .= "Bcc: ".$headertemp->bccaddress. "\r\n"; 
     382                $header .= "Sender: ".$headertemp->senderaddress. "\r\n"; 
     383                $header .= "Reply-to: ".$headertemp->reply_toaddress . "\r\n"; 
     384                $header .= "Subject: ".$headertemp->subject . "\r\n"; 
     385                $header .= "Content-Type: text/html". "\r\n"; 
    390386 
    391387                $msg = &new message_components($this->mbox); 
    392388                $msg->fetch_structure($params["msg_num"]);/* O fetchbody tava trazendo o email com problemas na acentuação. 
    393                                                              Então uso essa classe para verificar a codificação e o charset, 
    394                                                              para que o método decodeBody do expresso possa trazer tudo certinho*/ 
     389                        Então uso essa classe para verificar a codificação e o charset, 
     390                        para que o método decodeBody do expresso possa trazer tudo certinho*/ 
     391 
     392 
     393                $flags = $headertemp->Unseen == 'U' ? '' : '\Seen'; 
     394                $flags .= $headertemp->Flagged == 'F' ? ' \Flagged' : ''; 
     395                $flags .= $headertemp->Answered == 'A' ? ' \Answered' : ''; 
     396                $flags .= $headertemp->Draft == 'D' ? ' \ Draft' : ''; 
    395397 
    396398                $status = imap_append($this->mbox, 
    397                                 "{".$this->email_server['imapServer'].":".$this->email_server['imapPort'].$this->imap_options."}".$params["folder"], 
    398                                         $header. 
    399                                         "\r\n". 
    400                                         str_replace("\n","\r\n",$this->decodeBody( 
    401                                                         imap_fetchbody($this->mbox,imap_msgno($this->mbox, $params["msg_num"]),"1"), 
    402                                                         $msg->encoding[$params["msg_num"]][0], $msg->charset[$params["msg_num"]][0] 
    403                                                         ) 
    404                                         ), "\\Seen"); //Append do novo email, só com header e conteúdo sem anexos. 
     399                        "{".$this->email_server['imapServer'].":".$this->email_server['imapPort'].$this->imap_options."}".$params["folder"], 
     400                        $header. 
     401                        "\r\n". 
     402                        str_replace("\n","\r\n",$this->decodeBody( 
     403                                imap_fetchbody($this->mbox,imap_msgno($this->mbox, $params["msg_num"]),"1"), 
     404                                $msg->encoding[$params["msg_num"]][0], $msg->charset[$params["msg_num"]][0] 
     405                        ) 
     406                ), $flags); //Append do novo email, só com header e conteúdo sem anexos. 
    405407 
    406408                if(!$status) 
    407409                { 
    408410                        $return["status"] = false; 
    409                         $return["msg"] = lang("error appending mail on delete attachments"); 
     411                        $return["msg"] = "error appending mail on delete attachments"; 
    410412                } 
    411413                else 
Note: See TracChangeset for help on using the changeset viewer.