Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Send email using default app


Private Declare Function ShellExecute Lib "SHELL32.DLL" Alias "ShellExecuteA" _
( ByVal hwnd As Long , ByVal lpOperation As String , ByVal lpFile As String , _
ByVal lpParameters As String , ByVal lpDirectory As String , ByVal nShowCmd As Long ) As Long
Public Const SW_ShowNormal = 1

'This opens the system's default email application, with content filled in

Dim temp As String , iReturn As Long
Dim EmailReceiver As String , Subject As String , Message As String

EmailReceiver = "gbeene@airmail.net"
Subject = "Greetings"
Message = "How are you today?"    'use hex %0D%0A for new lines

temp = "mailto:" & EmailReceiver & "?subject=" & Message & "&body=" & Message

iReturn = ShellExecute(0&, "Open" , temp, vbNullString, vbNullString, SW_ShowNormal)