enough_mail icon indicating copy to clipboard operation
enough_mail copied to clipboard

Attachment file with Chinese file name, how to support chinese file name

Open function2000 opened this issue 4 months ago • 3 comments

I try to use send email with attachment, the file name is Chinese, for example 销售报告.pdf, But when send out, it is as 销售报告.pdf . Any idea to suppoer Chinese file name?

My code is as below:

for (final path in files) {
        final file = File(path);

        final mediaType = MediaType.guessFromFileExtension(file.path);

        await builder.addFile(file, mediaType);

      }

Thanks a lot!

function2000 avatar Sep 19 '25 06:09 function2000

      if (attachmentFiles != null && attachmentFiles.length > 0) {
        for (File file in attachmentFiles) {
          if (file.existsSync()) {
            MediaType mediaType = MediaType.guessFromFileName(file.path);
            await builder.addFile(file, mediaType);
          }
        }
      }
      MimeMessage mimeMessage = builder.buildMimeMessage(isRequestReadReceipt: isRequestReadReceipt);
      SmtpResponse sendResponse = await client.sendMessage(mimeMessage);

我试了下这样挺正常的,你那边用了高级的api吗

gghh0408 avatar Sep 28 '25 11:09 gghh0408

还是一样的:

Image

function2000 avatar Oct 03 '25 03:10 function2000

还是一样的:

Image

爱莫能助了哥们,我这边试了下中英文文件都挺正常。我是把他源码复制了一份搞到本地调了一下的。

gghh0408 avatar Oct 09 '25 05:10 gghh0408