0

Good day! Can't find the answer on my problem, so I need a help. I'm using MimeMessage to send e-message with pdf attachment which has cyrillic name. On thunderbird mail client I see attachmen's name as it should be(without any problem), but on outlook attachment's name look's like =UTF-8?4FG54... Attachment is pdf file, can't understand why it's happening, because I see mail's body text and subject on cyrillic on both clients properly.

MimeMessageHelper messageHelper = new MimeMessageHelper(message, true, "UTF-8");
messageHelper.setFrom("myMail@mail.com");
messageHelper.setTo("target@mail.com");
messageHelper.setSubject("Заголовок");
messageHelper.setText("Письмо");
messageHelper.addAttachment("Файл.pdf", new ByteArrayResource(data));
javaMailSender.send(message);  

message is MimeMessage type

2 Answers2

0

try this:

messageHelper.addAttachment(MimeUtility.encodeText("Файл.pdf", "CP1251", "B"), new ByteArrayResource(attach)); 

it's help for me

or this https://stackoverflow.com/a/49596504/8425969

Виктор
  • 221
  • 3
  • 5
0

try this

mimeMessageHelper.setEncodeFilenames(false);