Merge pull request #40 from bjornpost/fix-multipart-messagebody

In a multipart email messageBody() keeps headers
This commit is contained in:
Robert Hafner 2014-03-14 00:08:36 -07:00
commit 0bf95d78b2

View File

@ -432,7 +432,6 @@ class Message
$attachment = new Attachment($this, $structure, $partIdentifier); $attachment = new Attachment($this, $structure, $partIdentifier);
$this->attachments[] = $attachment; $this->attachments[] = $attachment;
} elseif ($structure->type == 0 || $structure->type == 1) { } elseif ($structure->type == 0 || $structure->type == 1) {
$messageBody = isset($partIdentifier) ? $messageBody = isset($partIdentifier) ?
imap_fetchbody($this->imapStream, $this->uid, $partIdentifier, FT_UID) imap_fetchbody($this->imapStream, $this->uid, $partIdentifier, FT_UID)
: imap_body($this->imapStream, $this->uid, FT_UID); : imap_body($this->imapStream, $this->uid, FT_UID);
@ -442,7 +441,7 @@ class Message
if (!empty($parameters['charset']) && $parameters['charset'] !== self::$charset) if (!empty($parameters['charset']) && $parameters['charset'] !== self::$charset)
$messageBody = iconv($parameters['charset'], self::$charset, $messageBody); $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)) { if (isset($this->plaintextMessage)) {
$this->plaintextMessage .= PHP_EOL . PHP_EOL; $this->plaintextMessage .= PHP_EOL . PHP_EOL;
} else { } else {
@ -451,7 +450,6 @@ class Message
$this->plaintextMessage .= trim($messageBody); $this->plaintextMessage .= trim($messageBody);
} else { } else {
if (isset($this->htmlMessage)) { if (isset($this->htmlMessage)) {
$this->htmlMessage .= '<br><br>'; $this->htmlMessage .= '<br><br>';
} else { } else {