diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index e7b039211f71b9c8ff8f472503ca75eed20e3924..9438e5e5df8f2edcb096fe9289ac7709bf7e4c78 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -518,6 +518,11 @@ class MailFetcher { if(!($mailinfo = $this->getHeaderInfo($mid))) return false; + // TODO: If the content-type of the message is 'message/rfc822', + // then this is a message with the forwarded message as the + // attachment. Download the body and pass it along to the mail + // parsing engine. + //Is the email address banned? if($mailinfo['email'] && TicketFilter::isBanned($mailinfo['email'])) { //We need to let admin know... diff --git a/include/class.mailparse.php b/include/class.mailparse.php index 3356cb9bf1a596272d3e46e9a2cb72dfc0c41ca5..1e9f81a5ceebe709684f18c1cc7b1f3465783863 100644 --- a/include/class.mailparse.php +++ b/include/class.mailparse.php @@ -56,7 +56,18 @@ class Mail_Parse { $this->splitBodyHeader(); $this->struct=Mail_mimeDecode::decode($params); - return (PEAR::isError($this->struct) || !(count($this->struct->headers)>1))?FALSE:TRUE; + if (PEAR::isError($this->struct)) + return false; + + // Handle wrapped emails when forwarded + if ($this->struct && $this->struct->parts) { + $outer = $this->struct; + $ctype = $outer->ctype_primary.'/'.$outer->ctype_secondary; + if (strcasecmp($ctype, 'message/rfc822') === 0) + $this->struct = $outer->parts[0]; + } + + return (count($this->struct->headers) > 1); } function splitBodyHeader() {