I was wondering how does one make an email go through visual basic? I.E. Using VB to send an email through Outlook Express... Any idea's or code?
Thanks
-Phil
Printable View
I was wondering how does one make an email go through visual basic? I.E. Using VB to send an email through Outlook Express... Any idea's or code?
Thanks
-Phil
Search the Forums. Allot of examples already. Search for
"ShellExecute" + "mailto".
HTH
Put your email address in the lblEmail.Caption. Just click the email label and it will send using Outlook or Outlook Express.
VB Code:
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 Const SW_SHOW = 5 Private Sub lblEmail_Click() ShellExecute Me.hwnd, "open", "mailto:" & lblEmail.Caption & "? _ subject=" & App.Title, vbNullString, vbNullString, SW_SHOW End Sub
This as been asked a few times on here. :wave:
isnt winsock safer? because its non OS setting dependent
ShellExecute is safe and only needs Windows NT 3.1 or later or
Windows 95 or later.
Only a few times? I got 123 hits on the search ShellExecute + mailto
and have seen it asked many times going back to 1999. This is
not a new idea.
You could also use the MAPI controls that come along with VB. They are pretty well documented.