diff --git a/include/api.tickets.php b/include/api.tickets.php index 00d7628b2e06076938a13df268b0a52fe05dbdc3..feca779c56927422490373136e8feb48d0bbd8d1 100644 --- a/include/api.tickets.php +++ b/include/api.tickets.php @@ -141,9 +141,10 @@ class TicketApiController extends ApiController { return $ticket; } - function processEmail() { + function processEmail($data=false) { - $data = $this->getEmailRequest(); + if (!$data) + $data = $this->getEmailRequest(); if (($thread = ThreadEntry::lookupByEmailHeaders($data)) && $thread->postEmail($data)) { diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index 9438e5e5df8f2edcb096fe9289ac7709bf7e4c78..21797c2313d815ccf5185bfca09d1a59aba7e2f0 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -522,6 +522,18 @@ class MailFetcher { // then this is a message with the forwarded message as the // attachment. Download the body and pass it along to the mail // parsing engine. + $info = Mail_Parse::splitHeaders($mailinfo['header']); + if (strtolower($info['Content-Type']) == 'message/rfc822') { + if ($wrapped = $this->getPart($mid, 'message/rfc822')) { + require_once INCLUDE_DIR.'api.tickets.php'; + // Simulate piping the contents into the system + $api = new TicketApiController(); + $parser = new EmailDataParser(); + if ($data = $parser->parse($wrapped)) + return $api->processEmail($data); + } + // If any of this fails, create the ticket as usual + } //Is the email address banned? if($mailinfo['email'] && TicketFilter::isBanned($mailinfo['email'])) {