Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAPI OLE control
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00233147
Message ID:
00234436
Views:
20
>Can someone please post me a sample code of how to send email message to multiple recipients using MAPI OLE control in VF6?
>
>I have the following working code, but it only sends to one recipient:
>oForm = CREATEOBJECT("Form")
>WITH oForm
> .AddObject("Session1","olecontrol","MSMAPI.MAPISession.1")
> .AddObject("Message1","olecontrol","MSMAPI.MAPIMessages.1")
> .Session1.SignOn
> .Message1.SessionID=oform.Session1.SessionID
> .Message1.RecipDisplayName="Recipient's address here"
> .Message1.MsgSubject="Subject here"
> .Message1.MsgNoteText="Message here"
> .Message1.Send
> .Session1.SignOff
> .Release
>ENDWITH
>
>Do I have to loop through the code each time in order to send it to each recipient? Or is there a simplier way to do so?
>
>Thanks in advance for your help.
>
>CARIE

The MAPI ActiveX controls handle information in collections. So you have to deal with and increment an index in a loop then set the recipient properties inside a loop. There are free samples in the files section showing how to do this.

Our Mail Manager product (a demo is available in the files section) provides a simplified interface, your code above would look like this:

oMail = CREATEOBJECT("MailManager")
WITH oMail
.Compose
.AddRecipient("Someone@Somewhere.com", "Someone's Name")
.Subject = "Subject here"
.Body = "Message here"
.Send
ENDWITH

In addition to an email engine, Mail Manager also includes a form component that you can drop on your form and bind to your form fields or map to expressions to allow an email to automatically be sent for each record in a queried resultset.
R. Scott Mackay
Classy Components Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform