diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2012-12-13 19:56:22 +0100 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2012-12-13 19:56:22 +0100 |
commit | dc67f38cdfd4390a6f5b302ebc177565536e4447 (patch) | |
tree | af94af182f52cbe8e2408b10015f05931bf26e80 /program | |
parent | 31521613e40bb57f430591bab30de2c202637db2 (diff) |
Properly parse message/rfc822 parts including all headers, body decoding and charset conversion
Diffstat (limited to 'program')
-rw-r--r-- | program/steps/mail/func.inc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 8ae41017e..7d6a51751 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -958,6 +958,10 @@ function rcmail_message_headers($attrib, $headers=null) $headers_obj = $MESSAGE->headers; $headers = get_object_vars($MESSAGE->headers); } + else if (is_object($headers)) { + $headers_obj = $headers; + $headers = get_object_vars($headers_obj); + } else { $headers_obj = rcube_message_header::from_array($headers); } @@ -1147,10 +1151,10 @@ function rcmail_message_body($attrib) // extract headers from message/rfc822 parts if ($part->mimetype == 'message/rfc822') { - list($hdrs, $body) = explode("\r\n\r\n", $part->body, 2); - if ($hdrs && $body && preg_match('/^[\w-]+:\s/i', $hdrs)) { - $out .= html::div('message-partheaders', rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : null, rcube_mime::parse_headers($hdrs))); - $part->body = $body; + $msgpart = rcube_mime::parse_message($part->body); + if (!empty($msgpart->headers)) { + $part = $msgpart; + $out .= html::div('message-partheaders', rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : null, $part->headers)); } } |