plain-text attachments are defined as type text in mails, which leads to the issue that in your lib I will only get the last item with type TEXT in bodies['text'].
In case of an txt-file you will see the return-parameters of imap_fetchstructure set like this:
That means, this part is an attachment not the text-body-part.
When your Message-Class runs through the parts you will only get the last part with type text in bodies['text'].
You should use the ifdisposition-flag.
I helped myself by changing the first if in fetchStructure of Message.php from
if ($structure->type == self::TYPE_TEXT) {
to
if ($structure->type == self::TYPE_TEXT && !$structure->ifdisposition) {
and than just added the TYPE_TEXT-Handling in your attachment-part:
switch($structure->type) {
case self::TYPE_TEXT:
$type = "Text";
break;
Only parts with not disposition and type text will go into bodies['text'] and the other parts will now end in the attachments. This is just my workaround and will not handle multiple non-attachment text-parts.
The right way would be to first test for the disposition flag and then handle dispositions of type "attachment" as attachment and dispositions of type "inline" or parts without disposition as bodies-parts.
Hi,
plain-text attachments are defined as type text in mails, which leads to the issue that in your lib I will only get the last item with type TEXT in bodies['text'].
In case of an txt-file you will see the return-parameters of imap_fetchstructure set like this:
That means, this part is an attachment not the text-body-part.
When your Message-Class runs through the parts you will only get the last part with type text in bodies['text'].
You should use the ifdisposition-flag.
I helped myself by changing the first if in fetchStructure of Message.php from
to
and than just added the TYPE_TEXT-Handling in your attachment-part:
Only parts with not disposition and type text will go into bodies['text'] and the other parts will now end in the attachments. This is just my workaround and will not handle multiple non-attachment text-parts.
The right way would be to first test for the disposition flag and then handle dispositions of type "attachment" as attachment and dispositions of type "inline" or parts without disposition as bodies-parts.
To go deeper into this, there are more disposition-types: http://www.iana.org/assignments/cont-disp/cont-disp.xhtml
Cheers, Matthias