Skip to content
Snippets Groups Projects
Commit 07fec4c4 authored by Jared Hancock's avatar Jared Hancock
Browse files

pipe: Unwrap forwarded emails

If the mail received into the system has a content type of 'message/rfc822',
then unwrap the inner message and use it as the parsed email. Effectively,
assume the email was forwarded as an message/rfc822 attachment.
parent 12882e60
No related branches found
No related tags found
No related merge requests found
......@@ -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...
......
......@@ -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() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment