user2234111 user2234111 - 1 year ago 83
C# Question

insert a link in to a email send using c#

i develop a program to send emails automatically using c#, and i want to insert a link to a web site to that email. how can i do it?

public bool genarateEmail(String from, String to, String cc, String displayName, String password, String subjet, String body)
bool EmailIsSent = false;

MailMessage m = new MailMessage();
SmtpClient sc = new SmtpClient();
m.From = new MailAddress(from, displayName);
m.To.Add(new MailAddress(to, displayName));
m.CC.Add(new MailAddress("", "Display name CC"));

m.Subject = subjet;
m.IsBodyHtml = true;
m.Body = body;

sc.Host = "";
sc.Port = 587;
sc.Credentials = new
System.Net.NetworkCredential(from, password);
sc.EnableSsl = true;

EmailIsSent = true;

catch (Exception ex)
EmailIsSent = false;

return EmailIsSent;

i want to send a link through this email. how should i add it to email?

Answer Source
 String body = "Your message : <a href=''></a>"
 m.Body = body;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download