Skip to content

Commit

Permalink
Merge pull request #40 from bjornpost/fix-multipart-messagebody
Browse files Browse the repository at this point in the history
In a multipart email messageBody() keeps headers
  • Loading branch information
tedivm committed Mar 14, 2014
2 parents b48ca17 + 7b42853 commit 0bf95d7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Fetch/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ protected function processStructure($structure, $partIdentifier = null)
$attachment = new Attachment($this, $structure, $partIdentifier);
$this->attachments[] = $attachment;
} elseif ($structure->type == 0 || $structure->type == 1) {

$messageBody = isset($partIdentifier) ?
imap_fetchbody($this->imapStream, $this->uid, $partIdentifier, FT_UID)
: imap_body($this->imapStream, $this->uid, FT_UID);
Expand All @@ -442,7 +441,7 @@ protected function processStructure($structure, $partIdentifier = null)
if (!empty($parameters['charset']) && $parameters['charset'] !== self::$charset)
$messageBody = iconv($parameters['charset'], self::$charset, $messageBody);

if (strtolower($structure->subtype) == 'plain' || $structure->type == 1) {
if (strtolower($structure->subtype) === 'plain' || ($structure->type == 1 && strtolower($structure->subtype) !== 'alternative')) {
if (isset($this->plaintextMessage)) {
$this->plaintextMessage .= PHP_EOL . PHP_EOL;
} else {
Expand All @@ -451,7 +450,6 @@ protected function processStructure($structure, $partIdentifier = null)

$this->plaintextMessage .= trim($messageBody);
} else {

if (isset($this->htmlMessage)) {
$this->htmlMessage .= '<br><br>';
} else {
Expand Down

0 comments on commit 0bf95d7

Please sign in to comment.