enough_mail
enough_mail copied to clipboard
Attachment file with Chinese file name, how to support chinese file name
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!
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吗
还是一样的:
还是一样的:
![]()
爱莫能助了哥们,我这边试了下中英文文件都挺正常。我是把他源码复制了一份搞到本地调了一下的。