Emailing several recipients
Posted on 2003-12-05
My app generates a string as follows:
EmailList = "John <firstname.lastname@example.org>;
It then calls the default email browser as follows:
in a module:
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
in my procedure:
WriteEmail = ShellExecute(frmFriendsDirectory.hwnd, "open", "Mailto:", EmailList, "", 1)
This works fine if EmailList has only one address. If it has multiple addresses as above, only the first one is entered.
I have also tried leaving it blank, as follows:
WriteEmail = ShellExecute(frmFriendsDirectory.hwnd, "open", "Mailto:", "", "", 1)
and then using
SendKeys EmailList, True
this doesn't work either. The closest I get is if I put it on the clipboard as follows:
and then click "Paste" on the browser. In Outlook Express, the keyboard command for Paste is CTRL + V. I also tried Sendkeys "^V" to send that. No luck.
Any suggestions ?