I am trying to send an email using C# console application to our employees. In the body of the email, I need to embed a network path. I am using stringBuilder to create the body of the email. Network path is like this:
\\pcm-test2\shared\PCM_GEO_TEST\NGS Forms
I created the C# code to embed the network path like this:
StringBuilder TelURL = new StringBuilder().Append("<a href=" + @"\\pcm-test2\shared\PCM_GEO_TEST\NGS Forms").Append(">HERE</a>");
I put the above string in the body of the email in C#. When I receive the email, I see the link that says "HERE", but when I hover over "HERE", I see, the network path like this: \pcm-test2\shared\PCM_GEO_TEST\NGS
Somehow the "Forms" part is not showing up in the body of the email. This is my complete code
public void sendEmail(List<string> toList)
{
string from = "test@test.com";
string UserName = ConfigurationManager.AppSettings["UserName"].ToString();
string password = ConfigurationManager.AppSettings["password"].ToString();
StringBuilder TelURL = new StringBuilder().Append("<a href=" + @"\\pcm- test2\shared\PCM_GEO_TEST\NGS Forms").Append(">HERE</a>");
using (MailMessage mm = new MailMessage())
{
mm.From = new MailAddress(from);
mm.To.Add(new MailAddress("rimi@test1.com"));
mm.Subject = "Test subject";
mm.Body = TelURL.ToString();
mm.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential(UserName, password);
client.Port = 111;
client.EnableSsl = true;
client.Host = "smtp.office365.com";
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mm);
}
}
How can I put the entire network path with "Forms" in the body of the email.
Any help will be appreciated