2012-09-07 282 views
0

我使用SmtpClient发送MAILMESSAGE简单Outlook电子邮件编码

MailMessage mailMessage = new MailMessage("[email protected]", "[email protected]"); 
mailMessage.Subject = string.Format("{0} Notification Item", communication); 

在我的身体我有。

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 }); 

现在,这一切工作,但是当我通过交换发送电子邮件到我的Outlook帐户。它将Url更改为读取%3F而不是“?”从我读过的这是因为Microsoft Exchange做URL编码。

任何想法如何我可以解决这个问题或任何人有经验,也许为什么这不起作用。

+0

请看这里http://stackoverflow.com/questions/5307923/asp-net-mailmessage-bodyencoding-and-mailmessage-subjectencoding-defaults – opewix

+1

您的工作应用程序的Web或赢得应用程序?,从MS助手的Web应用程序呢。 WebMail中的ASP.NET Web Pages参考 - System.Web.Helpers.dll - 良好的工作和完全支持所有的HTML tage&编码。 – Elyor

回答

0

解决方案是不使用URL Builder添加'?'在它的(QueryString)属性里面,它把它转换成%3F。