tedivm/Fetch — pull request #40 by bjornpost (2014-03-11 19:19:18+00:00)
Title: In a multipart email messageBody() keeps headers

First of all; thanks for a ton for this library! This really saves us a lot of work. I think I've found an issue, but I'm not really sure if it's a bug in Fetch, php's imap_fetchbody or the email source:

* Simplified raw data: https://gist.github.com/bjornpost/1f90e6904346fe5ca08a#file-raw-email-txt
* After calling `$message->getMessageBody()` I get: https://gist.github.com/bjornpost/1f90e6904346fe5ca08a#file-actual-message-body-txt
* I expected that getMessageBody() would've dropped the headers (and just returned "This is my message.").

After some investigation, I've found that `imap_fetchbody()` in https://github.com/tedivm/Fetch/blob/master/src/Fetch/Message.php#L436-L438 is called with `$partIdentifier = 1`, which causes `imap_fetchbody()` to return the entire message part (including headers) instead of just the message part's body (see comment here: http://www.php.net/manual/en/function.imap-fetchbody.php#89002).

--
Identical to #39, but adds a pull request with a potential fix.