Ignore:
Timestamp:
02/28/11 16:33:32 (13 years ago)
Author:
eduardoalex
Message:

Ticket #1565 - Resolvendo problema quando não há nada no campo to.

File:
1 edited

Legend:

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

    r3803 r3831  
    235235                $to = $header->to; 
    236236                $head_array['to'] = array(); 
    237                 $tmp = ( isset( $to[0]->personal ) ) ? imap_mime_header_decode($to[0]->personal) : NULL; 
    238                 $head_array['to']['name'] = ( isset( $tmp[0]->text ) ) ? $this->decode_string($this->decode_string($tmp[0]->text)) : NULL; 
    239                 $head_array['to']['email'] = ( isset( $to[0]->mailbox ) ) ? ( $this->decode_string($to[0]->mailbox) . "@" . ( ( isset( $to[0]->host ) ) ? $to[0]->host : '' ) ) : NULL; 
    240                 if(!$head_array['to']['name']) 
    241                         $head_array['to']['name'] = $head_array['to']['email']; 
     237                if($to[1] && $to[1]->host == ".SYNTAX-ERROR.") { //E-mails que não possuem o campo "para", vêm com o recipiente preenchido, porém com um recipiente a mais alegando erro de sintaxe. 
     238                        $head_array['to']['name'] = $head_array['to']['email'] = NULL; 
     239                } 
     240                else { 
     241                        $tmp = ( isset( $to[0]->personal ) ) ? imap_mime_header_decode($to[0]->personal) : NULL; 
     242                        $head_array['to']['name'] = ( isset( $tmp[0]->text ) ) ? $this->decode_string($this->decode_string($tmp[0]->text)) : NULL; 
     243                        $head_array['to']['email'] = ( isset( $to[0]->mailbox ) ) ? ( $this->decode_string($to[0]->mailbox) . "@" . ( ( isset( $to[0]->host ) ) ? $to[0]->host : '' ) ) : NULL; 
     244                        if(!$head_array['to']['name']) 
     245                                $head_array['to']['name'] = $head_array['to']['email']; 
     246                } 
    242247                $cc = $header->cc; 
     248                $cco = $header->bcc; 
    243249                if ( ($cc) && (!$head_array['to']['name']) ){ 
    244250                        $head_array['to']['name'] = ( isset( $cc[0]->personal ) ) ? $this->decode_string($cc[0]->personal) : NULL; 
    245251                        $head_array['to']['email'] = $this->decode_string($cc[0]->mailbox) . "@" . $cc[0]->host; 
     252                        if(!$head_array['to']['name']) 
     253                                $head_array['to']['name'] = $head_array['from']['email']; 
     254                } 
     255                else if ( ($cco) && (!$head_array['to']['name']) ){ 
     256                        $head_array['to']['name'] = ( isset( $cco[0]->personal ) ) ? $this->decode_string($cco[0]->personal) : NULL; 
     257                        $head_array['to']['email'] = $this->decode_string($cco[0]->mailbox) . "@" . $cco[0]->host; 
    246258                        if(!$head_array['to']['name']) 
    247259                                $head_array['to']['name'] = $head_array['from']['email']; 
Note: See TracChangeset for help on using the changeset viewer.