From b999bd7e5b7fee82d68b08927dc5f14012ff0503 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 16 Jun 2017 13:58:57 +0000 Subject: [PATCH] mail: mail is now capable to read Mailer-Daemons and extract parts as attachment git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3782 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- mail.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/mail.php b/mail.php index 61cfa0b..19115a8 100644 --- a/mail.php +++ b/mail.php @@ -916,13 +916,23 @@ class mail continue; $disposition = $this->getHeaderValue ("Content-Disposition", $section["_headersArray"]); - if ($disposition === false) + if ($disposition !== false) + { + if ($inline === true && substr ($disposition, 0, 6) === "inline") + $res[] = $sectionID; + elseif ($inline === false && + substr ($disposition, 0, 10) === "attachment") + $res[] = $sectionID; continue; - if ($inline === true && substr ($disposition, 0, 6) === "inline") - $res[] = $sectionID; - elseif ($inline === false && - substr ($disposition, 0, 10) === "attachment") - $res[] = $sectionID; + } + // The Mailer-Daemons use Content-Type: message/XXXX + $contentType = $this->getHeaderValue ("Content-Type", + $section["_headersArray"]); + if ($contentType !== false && substr ($contentType, 0, 8) === "message/") + { + if ($inline === false) + $res[] = $sectionID; + } } return $res; }