MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.61k stars 627 forks source link

MCOMessageParser and attachment with separated filename #1744

Open PaRaDoXLP opened 6 years ago

PaRaDoXLP commented 6 years ago

Hello! Faced with such problem using MailCore2 in MacOS project.

In structure of incoming mail has attacment with name, that was separated in such way

Content-Type: application/pdf;
    name*0="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed";
        name*1="  do eiusmod tempor incididunt ut labore et dolore magna al.p";
    name*2="df"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
    filename*0="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed";
    filename*1="  do eiusmod tempor incididunt ut labore et dolore magna al.p";
    filename*2="df"

MCOMessageParser return that attachment like in next without fileName:

  - 0 : <mailcore::Attachment:0x6000000cf5e0
mime type: application/pdf
inline: 0
data: 43863 bytes
>

Size of attachment is right, but filename was lost. Can You fix that problem?

haithngn commented 6 years ago

are you sure the coming email contained filename for the attachment ?

PaRaDoXLP commented 6 years ago

Yes, I'm sure. Example in my first message got from mail structure.

jraymonds86 commented 6 years ago

I can concur that mail sent as:

--Apple-Mail=_9F18A0EE-316B-466D-8533-55C37EF4FFB4
Content-Disposition: inline;
    filename*0="This is a test to see if a super long file name is the problem a";
    filename*1="ssociated with the XXXXXX mailcore2 issue that is making the fil";
    filename*2="ename nil.pdf"
Content-Type: application/pdf;
    x-unix-mode=0644;
    name="This is a test to see if a super long file name is the problem associated with the XXXXXX mailcore2 issue that is making the filename nil.pdf"
Content-Transfer-Encoding: base64

Works as expected but:

------=_Part_285121_1474425401.1526018147237
Content-Type: application/pdf;
    filename*0="This is a test to see if a super long file name is the problem a";
    filename*1="ssociated with the XXXXXX mailcore2 issue that is making the fil";
    filename*2="ename nil.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
    filename*0="This is a test to see if a super long file name is the problem a";
    filename*1="ssociated with the XXXXXX mailcore2 issue that is making the fil";
    filename*2="ename nil.pdf"

Does not.

Where exactly the problem is located is over my head when it comes to mail syntax since these two examples are encoded slightly differently.

PaRaDoXLP commented 6 years ago

Do you have some updates about that question?

dinhvh commented 6 years ago

libetpan doesn't parse properly MIME property with continuation (0, 1, *2).

LouisMari1991 commented 3 years ago

Is there a solution?

sebastienboisvert commented 1 year ago

Is there a solution?

+1; more and more messages use this format now (often leaving out the plain filename=... parameter).