Hyperlink an Email Address using LinkLabel in C#
You are not saying whether you are using Win- or WebForms...in WinForms I think you need to create an event-handler for the click event. Inside that you can start the default mail application by typing:
System.Diagnostics.Process.Start("mailto:[email protected]");
Check this SO thread:
How to send email using default email client?
Basically, the click event would be something like this:
private void linkLabel1_LinkClicked(object sender,System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "mailto:[email protected]?subject=hello&body=love my body";
proc.Start();
}
Add a LinkLabel
like this in the form's constructor:
linkLabel1.Links.Add(new LinkLabel.Link(0, linkLabel1.Text.Length, "mailto:[email protected]"));
Then, in the LinkLabel
's click handler:
linkLabel1.Links[linkLabel1.Links.IndexOf(e.Link)].Visited = true;
string target = e.Link.LinkData as string;
System.Diagnostics.Process.Start(target);