how do you send an email to a set address trhough a VB6 EXE? thanks in advance
Printable View
how do you send an email to a set address trhough a VB6 EXE? thanks in advance
If you want to open your e-mail client with an e-mail address already entered, try ShellExecute: http://www.vb-world.net/demos/shellexecute/ (mailto:[email protected] instead of http://www...
To really send e-mail, http://www.vbsquare.com/internet/pop/
This is assuming you have a label named lblMail
VB Code:
'in a form Private Sub lblMail_Click() On Error Resume Next ShellDocument "mailto:[email protected]" End Sub
VB Code:
' in a module Option Explicit Public 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) Public Enum StartWindowState START_HIDDEN = 0 START_NORMAL = 4 START_MINIMIZED = 2 START_MAXIMIZED = 3 End Enum Public Function ShellDocument(sDocName As String, _ Optional ByVal Action As String = "Open", _ Optional ByVal Parameters As String = vbNullString, _ Optional ByVal Directory As String = vbNullString, _ Optional ByVal WindowState As StartWindowState) As Boolean Dim Response Response = ShellExecute(&O0, Action, sDocName, Parameters, Directory, WindowState) Select Case Response Case Is < 33 ShellDocument = False Case Else ShellDocument = True End Select End Function
or you can use the cdonts component