Prevent Gmail from creating links for URLs and email addresses
Problem is Gmail automatically creates hyperlinks for all website URLs and email addresses. I do not want to create a link.
var mailClient = new SmtpClient();
var netMail = new MailMessage();
msg = "I do not want www.google.com as a link at recipient end. <br/>";
msg += "I want my email addrress [email protected] as html without a link";
var cr = new NetworkCredential("########", "###########");
netMail.From = new MailAddress("########@m####.###", "######");
netMail.To.Add(new MailAddress("[email protected]"));
netMail.Subject = "Test Mail";
netMail.IsBodyHtml = true;
netMail.Body = msg;
mailClient.Host = "xyz.com";
mailClient.Port = 25;
mailClient.EnableSsl = false;
mailClient.Credentials = cr;
mailClient.Send(netMail);
Any solution?
Solution 1:
I had a same issue and found out if you use email like this;
<a rel="nofollow" style='text-decoration:none; color:#333'>[email protected]</a>
email providers does not tend to follow email as a link.
Hope this helps.
Solution 2:
I was able to get around this issue just by adding <a style="color: #000000">link text</a>
(notice there is no href
).
I haven't tried using attributes besides style
but I would imagine you could. The email system that I use (Blackbaud NetCommunity) will strip out a plain <a>
tag, so I had to have at least one attribute.
Solution 3:
There's no way to stop creating URLs, because its automatically checked by the email provider that whether the text is a valid URL.
Only way to overcome this is, deceiving the parser. Just put spaces, HTML tags, whatever in such a way that the parser can't identify like URL etc.
Here are a few code examples:
http:<span>//foolishedsiteparser.com</span>
_http://www.parsersmashed.com
noonesemail<x>@</x>linkdead.com>
And the result is the following:
http://foolishedsiteparser.com
_http://www.parsersmashed.com
[email protected]