I am seeing weird behavior after upgrade the javamail API to 1.5.6 from 1.4.1. Email message is sent which has the attachment file name with multibyte characters (e.g. (代替機ログ)show tech-support.zip ) using 1.5.6, the email received in outlook which is installed on windows system in Japanese locale (please note the attachment appears correctly in thunderbird client in this scenario i.e. in Japanese locale with 1.5.6), the attachment file name gets converted into .dat extension (e.g. 10224.dat), while the attachment appear correctly when email is sent using javamail API version 1.4.1. We have seen the API has changed between 1.5.6 and 1.4.1, though the API 1.5.6 is backward compatible with 1.4.1, the email message with attachment that has multibyte characters is sent using 1.5.6, the outlook in English locale fails to parse the attachment file name and shows raw encoded data (e.g. ="=?utf8=?=…..) and then we used the below method and it at least worked in outlook installed in English locale.
Method used using 1.5.6 version – MimeBodyPart attachFile(…).
In the same decoded eml message data, I could see the difference in encoding raw string when email sent using version 1.5.6 and 1.4.1.
The file name encoding string in message structure using the API versions is as below.
- Attachment part of email sent using version 1.5.6 (failed in outlook on Japanese system locale) –
Content-Type: application/octet-stream;
name="=?utf-8?B?54Sh6aGM44Gu5re75LuY44OV44Kh44Kk44OrIDAwNTUzLmRhdA==?="
Content-Transfer-Encoding: base64
X-Rtf-RenderingPosition: -1
Content-Disposition: attachment;
filename="=?utf-8?B?54Sh6aGM44Gu5re75LuY44OV44Kh44Kk44OrIDAwNTUzLmRhdA==?="
- Attachment part of email sent using version 1.4.1 (successful in outlook on Japanese system locale) –
Content-Type: application/octet-stream;
name="=?utf-8?B?KOS7o+abv+apn+ODreOCsClzaG93IHRlY2gtc3VwcG9ydC56aXA=?="
Content-Transfer-Encoding: base64
X-Rtf-RenderingPosition: -1
Content-Disposition: attachment;
filename="=?utf-8?B?KOS7o+abv+apn+ODreOCsClzaG93IHRlY2gtc3VwcG9ydC56aXA=?="
Please help me to troubleshoot and resolve this problem.