简体   繁体   English

Outlook电子邮件编码

[英]Outlook Email Encoding

I am using SmtpClient to send a simple MailMessage 我正在使用SmtpClient发送简单的MailMessage

MailMessage mailMessage = new MailMessage("xyz@mydomain.com", "target@mydomain.com");
mailMessage.Subject = string.Format("{0} Notification Item", communication);

In my body I have. 我体内有。

mailMessage.BodyEncoding = Encoding.UTF8;
mailMessage.IsBodyHtml = true;

string Message = string.Format("You have received a new {0} notification from: {1} on Site: {2} please click <a href=\"{3}\">HERE</a> To view this notification item. <br/>Url: {3}<br/>",
new object[] { communicationType.ToString(), Employee.Name, Employee.DefaultSite.Name, thebuilder.Uri.OriginalString });

Now this all works however when I send the email to my outlook account through exchange. 现在,当我通过交换将电子邮件发送到我的Outlook帐户时,所有这些都可以使用。 It changes the Url to read %3F instead of a '?' 它将Url更改为读取%3F而不是'?' From what I've read this is because Microsoft Exchange does URL Encode. 从我读到的内容来看,这是因为Microsoft Exchange进行URL编码。

Any idea how I can fix this or anyone have experience in perhaps why this would not work. 我知道如何解决此问题的任何想法,或者任何人都有经验,也许为什么这不起作用。

The solution is to not use the URL Builder as adding a '?' 解决方案是不要将URL Builder用作添加“?” inside its (QueryString) attribute it casts this to a %3F. 在其(QueryString)属性中,将其强制转换为%3F。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM