Set "mail.strictly_mime.parm_folding" to javamail

I am using javamail to send mail with long nested filenames. Javamail follows a more recent RFC and covers the filename in two lines of mail header, like this example:

------=_Part_0_978693914.1433356404377
Content-Disposition: ATTACHMENT;
    filename*0="=?UTF-8?Q?arquivo_com_nome_grande_e_acentua=C3=A7=C3=A3o.png\"; f";
    filename*1="ilename*1=\"?="
Content-Type: APPLICATION/OCTET-STREAM;
    name*0="=?UTF-8?Q?arquivo_com_nome_grande_e_acentua=C3=A7=C3=A3o.png\"; n";
    name*1="ame*1=\"?="
Content-Transfer-Encoding: BASE64

      

Mail clients like Outlook don't understand this, so I don’t need to javamail; t split the filename on two lines.

Reading the RFC, I found an attribute that says it is not being shared: "Mail.strictly_mime.parm_folding"

How do I install it in javamail?

+3


source to share


2 answers


The mail.strictly_mime.parm_folding property for Thunderbird is not in the RFC.



According to this Thunderbird article, Outlook does not support RFC 2231 , which JavaMail uses to encode the filename parameter. You can disable RFC 2231 encoding by setting the JavaMail System property "mail.mime.encodeparameters" to "false". You probably want to set the System property "mail.mime.encodefilename" to "true" to use the non-standard file name encoding that Outlook supports.

+4


source


I found this issue on Wildfly Server V.10.x

Decisions in insert = "flowed" format in Content Type



MimeBodyPart part = new MimeBodyPart();
part.addHeader("Content-Type", "application/pdf; charset=\"UTF-8\"; format=\"flowed\"  ");
part.setFileName(MimeUtility.encodeText(file.getName(), "UTF-8", null));
//setDataHandler

      

+1


source







All Articles