0
votes

I am using SmtpClient to send a simple MailMessage

MailMessage mailMessage = new MailMessage("[email protected]", "[email protected]");
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. It changes the Url to read %3F instead of a '?' From what I've read this is because Microsoft Exchange does URL Encode.

Any idea how I can fix this or anyone have experience in perhaps why this would not work.

1
Your worked app web or win app?,for Web app from MS Helper yet.ASP.NET Web Pages reference - System.Web.Helpers.dll in WebMail - good worked and all html tage & encoding fully supported.Elyor

1 Answers

0
votes

The solution is to not use the URL Builder as adding a '?' inside its (QueryString) attribute it casts this to a %3F.