Open GoogleCodeExporter opened 8 years ago
Thanks for mentioning.
Original comment by buca...@gmail.com
on 14 Nov 2010 at 8:32
I had this problem too.
For me works something like this:
public function getMessageBody($type = 'text', $attach = "YES") {
$body = false;
$mime_types = array(
'text'=> 'text/plain',
'html'=> 'text/html'
);
if (in_array($type, array_keys($mime_types))) {
foreach($this->parts as $part) {
if ($this->getPartContentType($part) == $mime_types[$type]) {
$headers = $this->getPartHeaders($part);
switch($attach) {
case "NO":
if((!substr(trim($headers['content-disposition']),0,10) == "attachment"))
$body .= $this->decode($this->getPartBody($part), array_key_exists('content-transfer-encoding', $headers) ? $headers['content-transfer-encoding'] : '');
break;
case "ONLY":
if((substr(trim($headers['content-disposition']),0,10) == "attachment"))
$body .= $this->decode($this->getPartBody($part), array_key_exists('content-transfer-encoding', $headers) ? $headers['content-transfer-encoding'] : '');
break;
default: // YES
$body .= $this->decode($this->getPartBody($part), array_key_exists('content-transfer-encoding', $headers) ? $headers['content-transfer-encoding'] : '');
break;
};// switch($atatch)
}
}
} else {
throw new Exception('Invalid type specified for MimeMailParser::getMessageBody. "type" can either be text or html.');
}
return $body;
}
Original comment by martin.j...@gmail.com
on 14 Dec 2010 at 3:16
public function getMessageBody($type = 'text', $attach = "YES") {
call function with $attach =
NO => text/plain attachments are not added to body
YES => text/plain attachments are added to body
ONLY => only text/plain attachments are added to body
I added dot ( $body .= ) as well, because only last text/plain was retrieved.
Original comment by martin.j...@gmail.com
on 14 Dec 2010 at 3:21
Thank you very much for this fix! (It also works for the same kind of problem
with html attachments.)
Original comment by peter.pe...@gmail.com
on 29 Oct 2012 at 9:45
Original issue reported on code.google.com by
mfris...@tin.it
on 13 Nov 2010 at 4:45