Link to home
Start Free TrialLog in
Avatar of pierrecampe
pierrecampe

asked on

mailto:

How can i specify the subject and the body in an e-mail send with the 'mailto:' protocol
and maybe add an attachment
and how can i make outlook express send it immediately without it showing its new message window

what i do:

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 Const SW_SHOWNORMAL = 1

Private Sub Command1_Click()
    ShellExecute Me.hwnd, vbNullString, "mailto:campep@yucom.be;pirreke@belgacom.net", vbNullString, vbNullString, SW_SHOWNORMAL
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vinnyd79
vinnyd79

You should use a "?" mark instead of "&" in front of the subject like this:

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 Const SW_SHOWNORMAL = 1

Private Sub Command1_Click()
   ShellExecute Me.hwnd, vbNullString, "mailto:campep@yucom.be;pirreke@belgacom.net?subject=place subject here&Body=Place body here", vbNullString, vbNullString, SW_SHOWNORMAL
End Sub


I don't think the attachment part works with Outlook Express but it does work with Outlook.