php-imap-client icon indicating copy to clipboard operation
php-imap-client copied to clipboard

EXCEL attachment

Open nemcko16 opened this issue 6 years ago • 3 comments

Imap client do not show excel attachment. Can you help. Excel is not in TypeAttachments.php

nemcko16 avatar May 22 '19 20:05 nemcko16

I'm having the same issue but I have noticed that it is not just with excel but all of the office files (xls,xlsx,doc,docx,....)

I have edited the TypeAttachments.php file to include those attachments but that does not seem to do the trick.

Does anyone have an idea why this is happening?

cbielich avatar Jul 11 '19 01:07 cbielich

Ok, I am getting somewhere on this, I would make changes to the code but I am not sure exactly why it works.

The issue so far that I have been able to come up with is that has to do with the sections of the email and where the attachments are placed.

In IncomingMessage.php you will see const SECTION_ATTACHMENTS = 1;

if I change it to const SECTION_ATTACHMENTS = 0; then I am able to receive all my attachments like excel and word docs where before I was not able to. What is weird is that leaving it as 1 does allow some attachments to come in but not all unless I change it to 0.

The only issue so far with changing it to 0 is that it will also produce some empty results (attachments) so I am stuck here so far. Still digging through the code but I am getting close.

cbielich avatar Jul 12 '19 23:07 cbielich

In TypeAttachments.php add the correct mime type to the $types array. For example, Powerpoint PPTX file has type "VND.OPENXMLFORMATS-OFFICEDOCUMENT.PRESENTATIONML.PRESENTATION", some more:

Excel (.xls): VND.MS-EXCEL Excel (.xlsx): VND.OPENXMLFORMATS-OFFICEDOCUMENT.SPREADSHEETML.SHEET Adobe Illustrator (.ai): ILLUSTRATOR

Using "MIXED" might give you empty attachments. I simply check for empty names in that case.

hokascha avatar May 12 '20 12:05 hokascha