I have the following function which sends mail. The body of the mail has a link (href) in some cases.
public static void SendMail(string from, string to, string subject, string message, bool isHTML = true)
{
if (!String.IsNullOrEmpty(to) && ConfigurationManager.AppSettings["no_mail"] == null)
{
MailMessage mailMessage = new MailMessage(from,
to,
subject,
message);
string bccAddr = ConfigurationManager.AppSettings["managementMailAddress"];
if (!String.IsNullOrEmpty(bccAddr))
mailMessage.Bcc.Add(bccAddr);
bccAddr = ConfigurationManager.AppSettings["debugMailAddress"];
if (!String.IsNullOrEmpty(bccAddr))
mailMessage.Bcc.Add(bccAddr);
if (isHTML)
mailMessage.IsBodyHtml = true;
//mailMessage.BodyEncoding = System.Text.Encoding.UTF8; // avoid 3D?
SmtpClient smtpClient = new SmtpClient(ConfigurationManager.AppSettings["mailHost"]);
smtpClient.Send(mailMessage);
}
}
Yesterday the mail clients started receiving mails with 3D inserted after the equals sign, and so ceased to work properly.
For example, I see "...href=3Dhttp://..." instead of "...href=http://...".
I made a small change in the code with reference to the BCC list, but nothing that should have a serious effect. The web.config file has not changed, other than putting in various mail addresses in configuration variables.
Why are my links broken?