2012-09-07 279 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。