I'm using System.Net.Mail.SmtpClient.
I build my MailMessage. IsBodyHtml
is set to true. The Body is some html with some links.
Occasionally, some strange behavior occurs - an extra period will get added to one of the links. for example, the link will be set to this in the MailMessage Body:
<a href="http://www.myapp.com/company/contact">Contact Us</a>
but the email received shows up with an extra period:
<a href="http://www.myapp..com/company/contact">Contact Us</a>
The really strange behavior is that sometime the extra period will be added to a different link and sometimes it won't be added at all!
Is this a bug with System.Net.Mail.SmtpClient? Because the Body in the MailMessage does not have the extra period right as it's sent:
_smtp.Send(message); //message.Body has no extra period during sending
Note, I am using DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory
which is writing the email to a file.
Update:
I'm don't think this actually fixed it, but by setting message.BodyEncoding = System.Text.Encoding.UTF8;
, I can't seem to reproduce the bug. Any ideas why that may have fixed it?
IsBodyHtml
? – Kaiserslauternhref
in anchor tag or is it generated by some other method. This is really weird if it's happening after hard coding thehref
. – Sharlenesharline