Index: branches/5.2.x/core/units/helpers/email_message_helper.php =================================================================== diff -u -N -r14748 -r15222 --- branches/5.2.x/core/units/helpers/email_message_helper.php (.../email_message_helper.php) (revision 14748) +++ branches/5.2.x/core/units/helpers/email_message_helper.php (.../email_message_helper.php) (revision 15222) @@ -1,6 +1,6 @@ '', 'Headers' => '', 'HtmlBody' => '', 'PlainTextBody' => ''); + + if ( $message_type == '' ) { + // this is v5+ e-mail event text as xml node + foreach ($ret as $field => $value) { + $node_name = strtoupper($field); + $ret[$field] = (string)$text->$node_name; + } + + return $ret; + } + $line_id = 1; - $ret = Array ('Subject' => '', 'Headers' => '', 'Body' => ''); $headers = Array(); $lines = explode("\n", $text); // "\n" is lost in process foreach ($lines as $line_id => $line) { - if (strlen(trim($line)) == 0 || ($line == '.')) { + if ( strlen(trim($line)) == 0 || ($line == '.') ) { break; } $parts = explode(':', $line, 2); - if (strtolower($parts[0]) == 'subject') { + + if ( strtolower($parts[0]) == 'subject' ) { $ret['Subject'] = trim($parts[1]); } else { @@ -48,7 +61,7 @@ $lines = array_slice($lines, $line_id + 1); // add "\n", that was lost before - $ret['Body'] = implode("\n", $lines); + $ret[$message_type == 'html' ? 'HtmlBody' : 'PlainTextBody'] = implode("\n", $lines); return $ret; }