Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mailto

0 views
Skip to first unread message

Thomas Müller

unread,
May 27, 2004, 8:29:15 AM5/27/04
to
Hallo Newsgroup,

kann ich in vb .net einen Button realisieren der beim Anklicken eine neue
Email im Standard-Emailprogramm öffnet. Ähnlich der mailto-Funktion im html:
mailto:test...@irgend.wo?subject=Subject

Vielen Dank im voraus
Thomas


Armin Zingler

unread,
May 27, 2004, 8:48:07 AM5/27/04
to
"Thomas Müller" <tmue...@tmits.de> schrieb

> Hallo Newsgroup,
>
> kann ich in vb .net einen Button realisieren der beim Anklicken eine
> neue Email im Standard-Emailprogramm öffnet. Ähnlich der
> mailto-Funktion im html: mailto:test...@irgend.wo?subject=Subject

process.start("mailto:test...@irgend.wo?subject=Subject")


--
Armin


Thomas Müller

unread,
May 27, 2004, 8:44:51 AM5/27/04
to
Vielen Dank für die schnelle Antwort.
Thomas

"Armin Zingler" <az.n...@freenet.de> schrieb im Newsbeitrag
news:40b5e3a1$0$145$9b62...@news.freenet.de...

Herfried K. Wagner [MVP]

unread,
May 27, 2004, 10:34:13 AM5/27/04
to
Hallo Thomas!

* "Thomas Müller" <tmue...@tmits.de> scripsit:


> kann ich in vb .net einen Button realisieren der beim Anklicken eine neue
> Email im Standard-Emailprogramm öffnet. Ähnlich der mailto-Funktion im html:
> mailto:test...@irgend.wo?subject=Subject

Achtung mit Armins Lösung: Manche Zeichen müssen korrekt codiert werden.

Meine FAQ:

Opening the default mail client with a mail template:

Sample based on work by Fergus Cooney and Cor (mpdl.vb), optimized and
extended by Herfried K. Wagner [MVP]:

Add a reference to "System.Web.dll". Then you can use this code:

\\\
Imports System.Diagnostics
Imports System.Web

Public Sub StartDefaultMail( _
ByVal [To] As String, _
Optional ByVal Subject As String = "", _
Optional ByVal Message As String = "" _
)
Try
Dim psi As New ProcessStartInfo
psi.UseShellExecute = True
psi.FileName = _
"mailto:" & HttpUtility.UrlEncode([To]) & _
"?subject=" & HttpUtility.UrlEncode(Subject) & _
"&body=" & HttpUtility.UrlEncode(Message)
Process.Start(psi)
Catch ex As Exception
Throw _
New Exception( _
"Default mail client could not be started.", _
ex _
)
End Try
End Sub
///

Usage:

\\\
StartDefaultMail( _
"f...@goo.baz", _
"Invitation", _
"Do you want to come to my party?" _
)
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

0 new messages