andyedinborough / aenetmail

C# POP/IMAP Mail Client
370 stars 153 forks source link

Attachments Content-Disposition #68

Open undead85 opened 12 years ago

undead85 commented 12 years ago

Some email don't have Content-Disposition and i cant get attachments.

537mfb commented 12 years ago

Check Content-Description and Content-ID (message.Attachments.Headers["Content-Description"] and message.Attachments.Headers["Content-ID"])

Either one of those usually gets me the filename You will have to parse them looking for something like name="filename.ext" Can you work with those instead?

angraxs2 commented 12 years ago

I am also having this trouble and this workaround didn´t work neither because there is no message.Attachments.Headers

537mfb commented 12 years ago

each attachment has a Headers (Or used to anyway - am not using the latest version yet) don't have my code at hand just now but use something like:

foreach(Attachement a in message.Attachements)
    MessageBox.Show(a.Headers["Content-Description"]);

There also used to be a RawHeaders that was better than Headers although you would have to parse the value yourself

jstedfast commented 10 years ago

Not all MIME parts are guaranteed to have a Content-Disposition header. MIME parts don't even necessarily need to have any headers at all. This is all explained in the rfcs...