C# 发送长主题时,主题以编码格式显示
我正在使用System.Net.mail向outlook发送邮件 这里是我使用的代码C# 发送长主题时,主题以编码格式显示,c#,.net,outlook,C#,.net,Outlook,我正在使用System.Net.mail向outlook发送邮件 这里是我使用的代码 msg.From = new MailAddress("stagingsupport@syncfusion.com"); msg.IsBodyHtml = true; msg.Body = "Some text"; msg.To.Add("karthike@syncfusion.com"); msg.Subject = "[Enterprise Priority]
msg.From = new MailAddress("stagingsupport@syncfusion.com");
msg.IsBodyHtml = true;
msg.Body = "Some text";
msg.To.Add("karthike@syncfusion.com");
msg.Subject = "[Enterprise Priority] - Customer Incident 85172 for Karthik (108269) velusamys@syncfusion.com : Custom function called from within an AND function results in error - Syncfusion Website Team Test I – Created";
我得到的主题是=?utf-8?B?W0VudGVycHJpc2UgU
我不能在主题中提供任何非ascii字符,但我是以编码形式提供的。我参考了下面的链接,我不能得到那么多的解决方案
我必须遵循什么才能使主题以正确的解码形式出现?您必须设置UTF8编码
msg.SubjectEncoding= System.Text.Encoding.UTF8;
怎么了?这是表示电子邮件标题的方法之一,对我来说是正确的。也为BodyEncoding设置相同的编码。我确实得到了。outlook中有任何错误吗?没有。没关系。您的程序使用.net API。outlook没有解码编码的主题行,因为它超出了最大长度限制。我想说的是,编码的主题将被截断,outlook无法解码被截断的编码主题。我想这就是问题所在。你能给我解决办法吗?