aenetmail icon indicating copy to clipboard operation
aenetmail copied to clipboard

Attachment filenames not being fetch in some cases

Open 537mfb opened this issue 11 years ago • 7 comments

The case specifically looks like:

Content-Type: application/msword; name_0_=ISO-8859-1''0305%20-%20MULTILINGUES%20-%20Solicita%E7%E3o%20de%20; name_1_=or%E7amento%20%28Alem%E3o%20Portugu%EAs%29.doc Content-Disposition: attachment; filename_0_=ISO-8859-1''0305%20-%20MULTILINGUES%20-%20Solicita%E7%E3o%20d; filename_1_=e%20or%E7amento%20%28Alem%E3o%20Portugu%EAs%29.doc Content-Transfer-Encoding: base64

name_0_ and name_1_ get appended to rawvalue of contente-type and filename_0_ and filename_1_ get appended to rawvalue of contente-disposition - both without decoding the name and beeing kept separate

attachement.Headers["Content-Type"].rawvalue == "application/msword;\r\n\tname_0_=ISO-8859-1''0305%20-%20MULTILINGUES%20-%20Solicita%E7%E3o%20de%20;\r\n\tname_1_=or%E7amento%20%28Alem%E3o%20Portugu%EAs%29.doc\r\n";

537mfb avatar Apr 08 '13 16:04 537mfb

Is there a newline before name*0* and filename*0* in the actual header? Do you have an example of a full email you could forward to me at [email protected]?

andyedinborough avatar Apr 08 '13 16:04 andyedinborough

Oh nevermind. I'm sorry, your code shows there should be a newline and tab preceeding both. Let me look into this more.

andyedinborough avatar Apr 08 '13 17:04 andyedinborough

will send you an example in the morning - and yes there are newlines AND tabs there as per my final equality shows - Also the filenames are encoded - looks like some form of URL encoding but with the ISO-8859-1 charset specified

537mfb avatar Apr 08 '13 19:04 537mfb

Mail exemple sent - let me know if you need something

537mfb avatar Apr 09 '13 08:04 537mfb

Just noticed that some mail cliente apps (tested with Windows Live Mail) will not retrieve the filenames properly and just replace that with one in the form ATTxxxxx.ext with xxxxx being digits with no particular order i can see.

It does get the extension file correct though somehow

This leads me to the question - could there be something off with that file name scheme? not follow standard or something like that? or was the mail client devs just lazy and not implement it?

537mfb avatar Apr 09 '13 20:04 537mfb

The name and filename parameter encoding is specified in rfc2184 and rfc2231.

My MIME parser library, MimeKit, has a decoder for this.

jstedfast avatar Jan 10 '14 01:01 jstedfast