Launching a Mailto: URL

V

Vance Gloster

Hi all,

In a Windows Form application I need to launch the user's email application
and create a message that they will then send, much as you can do in a web
page with an Anchor tag with the HREF set to mailto:[email protected]. Is
there any way to do this programmatically within the .NET framework? I need
to have the program generate and launch the URL, not just have an active
link the user can push using a LinkLabel. I have tried setting the target
of a link label to a mailto URL, but it does not seem to function when I
press the button. I know I can do a DllImport on MAPI functions to do
something similar.

I am currently using a DllImport on SHGetSpecialFolderPath to get the path
to the desktop directory. Is there a better approach that stays within
managed code? Thanks for your help!

-Vance Gloster

P.S. I am not writing a virus. This is a legitimate encryption application
that encrypts a document and attaches it to an outgoing email message.
 
H

Herfried K. Wagner [MVP]

* "Vance Gloster said:
Hi all,

In a Windows Form application I need to launch the user's email application
and create a message that they will then send, much as you can do in a web
page with an Anchor tag with the HREF set to mailto:[email protected]. Is
there any way to do this programmatically within the .NET framework? I need
to have the program generate and launch the URL, not just have an active
link the user can push using a LinkLabel. I have tried setting the target
of a link label to a mailto URL, but it does not seem to function when I
press the button. I know I can do a DllImport on MAPI functions to do
something similar.

\\\
Imports System.Diagnostics
..
..
..
Dim psi As New ProcessStartInfo()
psi.FileName = "mailto:foo@..."
psi.UseShellExecute = True
Process.Start(psi)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top