summaryrefslogtreecommitdiff
path: root/program/steps/mail/func.inc
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2012-12-13 19:56:22 +0100
committerThomas Bruederli <thomas@roundcube.net>2012-12-13 19:56:22 +0100
commitdc67f38cdfd4390a6f5b302ebc177565536e4447 (patch)
treeaf94af182f52cbe8e2408b10015f05931bf26e80 /program/steps/mail/func.inc
parent31521613e40bb57f430591bab30de2c202637db2 (diff)
Properly parse message/rfc822 parts including all headers, body decoding and charset conversion
Diffstat (limited to 'program/steps/mail/func.inc')
-rw-r--r--program/steps/mail/func.inc12
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));
}
}