Send EMail thru VB without User Intervention
From: Dennis (DBARNETT_at_CCC.HSHS.ORG)
Date: 05/20/04
- Next message: Jeff Johnson [MVP: VB]: "Re: Looping through controls in a panel"
- Previous message: Dick Grier: "Re: Any controls that allow communication to the LPT port?"
- Next in thread: Veign: "Re: Send EMail thru VB without User Intervention"
- Reply: Veign: "Re: Send EMail thru VB without User Intervention"
- Reply: David Whitman: "Re: Send EMail thru VB without User Intervention"
- Messages sorted by: [ date ] [ thread ]
Date: 20 May 2004 10:56:15 -0700
Hi
I found the code snippet below on this newsgroup and it works well,
as long as the user clicks the send button.
Can anyone tell me how to send the email behind the scenes without it
coming up and requiring user intervention?
Thanks
Dennis
Const SW_SHOWNORMAL = 1
Const kgCrLf = "%0D%0A"
Const Nil = vbNullString
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
Private Sub Command1_Click()
If ShellExecute(Me.hwnd, "open", _
"mailto:me@myemail.org" & _
"?Subject=Test Email generated from VB ..." & _
"&cc=you@youremail.org" & _
"&bcc=him@hisemail.org" & _
"&body=This is line one" & kgCrLf & "Line two", _
Nil, _
Nil, _
SW_SHOWNORMAL) <= 32 Then
MsgBox "Some error message"
End If
End Sub
- Next message: Jeff Johnson [MVP: VB]: "Re: Looping through controls in a panel"
- Previous message: Dick Grier: "Re: Any controls that allow communication to the LPT port?"
- Next in thread: Veign: "Re: Send EMail thru VB without User Intervention"
- Reply: Veign: "Re: Send EMail thru VB without User Intervention"
- Reply: David Whitman: "Re: Send EMail thru VB without User Intervention"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|