-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting the attachment code is invalid #1041
Comments
附件名称测试-1.zip |
Took a quick look at the code and it looks like you are right - the charset string value is not getting used |
Can you confirm whether or not your |
I set the SendMail Code
|
the |
The above fixes that I committed yesterday should fix the issue. For what it's worth, FormatOptions.International is supposed to enable Unicode Email (which it technically still isn't doing after my fix, but it also sounds like that's not what you want). In other words, MimeKit shouldn't be encoding email headers at all when FormatOptions.International is set to true. |
You can test my fixes by using the latest NuGet package from here: https://www.myget.org/feed/mimekit/package/nuget/MimeKit |
ParserOptions.CharsetEncoding is only used for parsing and is the fallback charset in case it encounters unencoded 8bit headers. It's not anything you should be concerned about for this. |
1 thing I should add, though, is that if you want it to use the =?gb18030?b?...?= style of encoding is that you can do this: attachment.ContentDisposition.Parameters.Add(new Parameter("GB18030", "filename", mailAttachment.FileName) { EncodingMethod = ParameterEncodingMethod.Rfc2047 });
attachment.ContentType.Parameters.Add(new Parameter("GB18030", "name", mailAttachment.FileName) { EncodingMethod = ParameterEncodingMethod.Rfc2047 }); In general, the default encoding method should be used, but some mail clients only understand the rfc2047 encoding method. I'm not sure if that is important for your usage or not. |
Just as you said, some mail clients only understand the rfc2047 encoding method such as outlook 2019 or enterprise wechat client. |
Describe the bug
I use
BodyBuilder
to set attachment's encoding GB18030.But the encoding is still utf8.
Platform (please complete the following information):
My Code
Mail Content
The text was updated successfully, but these errors were encountered: