I am sending mail with MimeMessageHelper
in my Spring Boot application.
How can I tell it to encode the filename, which contains the letter
I've solved the the problem with these lines:
System.setProperty("mail.mime.splitlongparameters", "false")
MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8")
MimeUtility.encodeWord(attachmentFilename)
Here is the example code,
System.setProperty("mail.mime.splitlongparameters", "false");
MimeMessage message = sender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8");
// Your email content
helper.setFrom("...");
helper.setTo("...");
helper.setSubject("...");
helper.setText("...");
helper.addAttachment(
MimeUtility.encodeWord(attachmentFilename),
attachmentContent
);