I want to know how to create something similar to a mailto:
link (like on HTML pages) to a Windows Form. So that on clicking it, the users default mail program should open a new blank email with the given email address in the To:
field.
You can create an HTML mailto link by using an anchor tag with the href attribute and inserting the “mailto” parameter after it. If you want to send an email to more than one address, separate your email address with a comma.
If you want to add a subject to that e-mail add ? subject=<subject> to the mailto tag. For example, the complete tag would look similar to the example below. You can also add body text by adding &body=body to the end of the tag, as shown in the example below.
If this is a .NET application then you can use a LinkLabel
control. Just set the text property to the actual email address and then respond to the LinkClicked
event handler like this:
System.Diagnostics.Process.Start("mailto:" & LinkLabel1.Text);
You'll want to do some sanity checking on the email address and add some error trapping, but that should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With