Changeset 4904 for contrib/z-push
- Timestamp:
- 08/05/11 09:08:52 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/z-push/backend/imap.php
r4903 r4904 120 120 $body_base64 = false; 121 121 $org_charset = ""; 122 $from_value = ""; 123 $return_path_value = ""; 122 124 $org_boundary = false; 123 125 $multipartmixed = false; … … 156 158 } 157 159 158 // check if "from"-header is set, do nothing if it's set159 // else set it to IMAP_DEFAULTFROM160 160 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; 181 167 182 168 // 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")){ 189 177 if (IMAP_DEFAULTFROM == 'username') $v = $this->_username; 190 178 else if (IMAP_DEFAULTFROM == 'domain') $v = $this->_domain; 191 179 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; 205 189 206 190 // 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.