diff --git a/externals/mimemailparser/MimeMailParser.class.php b/externals/mimemailparser/MimeMailParser.class.php --- a/externals/mimemailparser/MimeMailParser.class.php +++ b/externals/mimemailparser/MimeMailParser.class.php @@ -308,10 +308,10 @@ * @param $part Array */ private function getPartHeaders($part) { - if (isset($part['headers'])) { + if (isset($part['headers']) && $part['headers']) { return $part['headers']; } - return false; + throw new Exception('MimeMailParser::getHeaders() could not parse any email headers.'); } /** diff --git a/scripts/mail/mail_handler.php b/scripts/mail/mail_handler.php --- a/scripts/mail/mail_handler.php +++ b/scripts/mail/mail_handler.php @@ -55,7 +55,9 @@ } $headers = $parser->getHeaders(); -$headers['subject'] = phutil_decode_mime_header($headers['subject']); +if (array_key_exists('subject', $headers)) { + $headers['subject'] = phutil_decode_mime_header($headers['subject']); +} $headers['from'] = phutil_decode_mime_header($headers['from']); if ($args->getArg('process-duplicates')) {