?
Solved

Emailing several recipients

Posted on 2003-12-05
9
Medium Priority
?
251 Views
Last Modified: 2010-05-01
My app generates a string as follows:
EmailList = "John <john@aol.com>;
                  Paul <paul@xyz.com>;
                  Mary <mary@abc.com>"

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:

    Clipboard.Clear
    Clipboard.SetText EmailList

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 ?

0
Comment
Question by:gron
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 500 total points
ID: 9882673
Put each entri separated by commas, not as parameter but inside lpFile.
I mean, composse all lpFile parameter like:

"mailto:entry-1,entry-2,entry-n&subject=......"
0
 
LVL 1

Author Comment

by:gron
ID: 9883265
Richie:

This appears to work only if I use the format:

"Mailto:mary@abc.com,john@aol.com,steve@xyz.ca"

But if I use the format:

"Mailto:Mary <mary@abc.com>,John <john@aol.com>, Steve <steve@xyz.ca>"

it only registers the first one. Is there a format where I can enter the name and address both ?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9883381
If you have that list in your address book, you could use name only.
I think you cannot use both with mailto.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9883390
Also, if you really want to do in a strong way, cahnge your approcah and use this exelent/free component:
http://www.freevbcode.com/ShowCode.Asp?ID=109
0
 

Expert Comment

by:vwdan2001
ID: 9883540
Have you played around with CDO or CDONTS?

There is a component I am currently using with exchange srvr. Its cheap and only uses about 3-5 lines of code. http://www.dimac.net 

There are several options with it.
0
 
LVL 1

Author Comment

by:gron
ID: 9887916
I have opted for the first suggestion with email addresses only.
I am still with Vb5, so some of the other options are not available to me.
Thanks.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9889365
what do you mean with other options?
0
 
LVL 1

Author Comment

by:gron
ID: 9891726
I meant your other suggestion:

http://www.freevbcode.com/ShowCode.Asp?ID=109 

I looked at that, and it is in Vb6. Also, it is far more complex and featured than I require.

Also the suggestion from vwdan2001.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9894770
No problem, code could be used in VB5 too!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question