Changeset 4904 for contrib/z-push


Ignore:
Timestamp:
08/05/11 09:08:52 (13 years ago)
Author:
thiagoaos
Message:

Ticket #2193 - Corrigido duplicação do atributo From na fonte da mensagem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • contrib/z-push/backend/imap.php

    r4903 r4904  
    120120                $body_base64 = false; 
    121121                $org_charset = ""; 
     122                $from_value = ""; 
     123                $return_path_value = ""; 
    122124                $org_boundary = false; 
    123125                $multipartmixed = false; 
     
    156158                        } 
    157159 
    158                         // check if "from"-header is set, do nothing if it's set 
    159                         // else set it to IMAP_DEFAULTFROM 
    160160                        if ($k == "from") { 
    161                                 if (trim($v)) { 
    162                                         $changedfrom = true; 
    163                                 } elseif (! trim($v) && IMAP_DEFAULTFROM) { 
    164                                         $changedfrom = true; 
    165                                         if      (IMAP_DEFAULTFROM == 'username') $v = $this->_username; 
    166                                         else if (IMAP_DEFAULTFROM == 'domain')   $v = $this->_domain; 
    167                                         else $v = $this->_username . IMAP_DEFAULTFROM; 
    168                                         $envelopefrom = "-f$v"; 
    169                                 } 
    170                         } 
    171  
    172                         // check if "Return-Path"-header is set 
    173                         if ($k == "return-path") { 
    174                                 $returnPathSet = true; 
    175                                 if (! trim($v) && IMAP_DEFAULTFROM) { 
    176                                         if      (IMAP_DEFAULTFROM == 'username') $v = $this->_username; 
    177                                         else if (IMAP_DEFAULTFROM == 'domain')   $v = $this->_domain; 
    178                                         else $v = $this->_username . IMAP_DEFAULTFROM; 
    179                                 } 
    180                         } 
     161                                $from_value = $v; 
     162                                $envelopefrom = "-f$v"; 
     163                        } 
     164 
     165                        if ($k == "return-path") 
     166                                $return_path_value = $v; 
    181167 
    182168                        // all other headers stay 
    183                         if ($headers) $headers .= "\n"; 
    184                         $headers .= ucfirst($k) . ": ". $v; 
    185                 } 
    186  
    187                 // set "From" header if not set on the device 
    188                 if(IMAP_DEFAULTFROM && !$changedfrom){ 
     169                        if($k != "from" && $k != "return-path") { 
     170                                if ($headers) $headers .= "\n"; 
     171                                $headers .= ucfirst($k) . ": ". $v; 
     172                        } 
     173                } 
     174 
     175                // override set "From" and "return-path" header 
     176                if(defined("IMAP_DEFAULTFROM")){ 
    189177                        if      (IMAP_DEFAULTFROM == 'username') $v = $this->_username; 
    190178                        else if (IMAP_DEFAULTFROM == 'domain')   $v = $this->_domain; 
    191179                        else $v = $this->_username . IMAP_DEFAULTFROM; 
    192                         if ($headers) $headers .= "\n"; 
    193                         $headers .= 'From: '.$v; 
    194                         $envelopefrom = "-f$v"; 
    195                 } 
    196  
    197                 // set "Return-Path" header if not set on the device 
    198                 if(IMAP_DEFAULTFROM && !$returnPathSet){ 
    199                         if      (IMAP_DEFAULTFROM == 'username') $v = $this->_username; 
    200                         else if (IMAP_DEFAULTFROM == 'domain')   $v = $this->_domain; 
    201                         else $v = $this->_username . IMAP_DEFAULTFROM; 
    202                         if ($headers) $headers .= "\n"; 
    203                         $headers .= 'Return-Path: '.$v; 
    204                 } 
     180 
     181                        if(trim($v) != "") { 
     182                                $from_value = $return_path_value = $v; 
     183                                $envelopefrom = "-f$v"; 
     184                        } 
     185                } 
     186 
     187                if ($headers) $headers .= "\n"; 
     188                $headers .= "From: ".$from_value."\nReturn-Path: ".$return_path_value; 
    205189 
    206190                // if this is a multipart message with a boundary, we must use the original body 
Note: See TracChangeset for help on using the changeset viewer.