From ffd04081d4aee4e9ead1d4a933ec34164de9dfed Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 27 Jan 2014 16:33:53 -0600
Subject: [PATCH] pipe: Honor inline bodies as valid message

Previously, if a message had a Content-Disposition header, then it could not
be considered as the body of the message.
---
 include/class.mailparse.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/class.mailparse.php b/include/class.mailparse.php
index 1e9f81a5c..34209b67c 100644
--- a/include/class.mailparse.php
+++ b/include/class.mailparse.php
@@ -246,7 +246,10 @@ class Mail_Parse {
 
         if($struct && !$struct->parts) {
             $ctype = @strtolower($struct->ctype_primary.'/'.$struct->ctype_secondary);
-            if($ctype && strcasecmp($ctype,$ctypepart)==0) {
+            if ($struct->disposition
+                    && (strcasecmp($struct->disposition, 'inline') !== 0))
+                return '';
+            if ($ctype && strcasecmp($ctype,$ctypepart)==0) {
                 $content = $struct->body;
                 //Encode to desired encoding - ONLY if charset is known??
                 if (isset($struct->ctype_parameters['charset']))
@@ -260,8 +263,7 @@ class Mail_Parse {
         $data='';
         if($struct && $struct->parts && $recurse) {
             foreach($struct->parts as $i=>$part) {
-                if($part && !$part->disposition
-                        && ($text=$this->getPart($part,$ctypepart,$recurse - 1)))
+                if($part && ($text=$this->getPart($part,$ctypepart,$recurse - 1)))
                     $data.=$text;
             }
         }
-- 
GitLab