Solved

using mapi with visual basic

Posted on 2001-08-16
6
523 Views
Last Modified: 2013-11-25
how do i send mail messages with the mapi controls to many recipient at a time using the BCC (other people don't see to whom the mail has been sent?)
thx
David
0
Comment
Question by:davtoche
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:Ranger2081200
ID: 6392034
davtoche,

I use the MAPIMessages control.
Once I have entered the recipients I want to send the message to, I then use RecipType = 3

Example:

MAPISession1.LogonUI = False
MAPISession1.UserName = "MICROSOFT OUTLOOK"
MAPISession1.SignOn
MAPIMessages.SessionID = MAPISession1.SessionID
MAPIMessages.Compose
MAPIMessages.RecipDisplayName = "Test User"
MAPIMessages.RecipAddress = "TestUser@somewhere.com"
MAPIMessages.ResolveName
MAPIMessages.RecipType = 3      '<***** This is Bcc *******
MAPIMessages.MsgSubject = "test!"
'Create the message
MAPIMessages.MsgNoteText = strEmailMessage
MAPIMessages.Send False
MAPISession1.SignOff

The 3 is "Bcc"
2 is "cc"
1 is "To"

Later...
0
 

Author Comment

by:davtoche
ID: 6392518
Thank you very much
Great!!
0
 

Author Comment

by:davtoche
ID: 6392573
how do i type :
MAPIMessages.RecipAddress = "TestUser@somewhere.com"
to have a list of recipients?
0
Industry Leaders: 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 1

Accepted Solution

by:
Ranger2081200 earned 100 total points
ID: 6396132
davtoche,

The way that I do it is to loop through a recordset or array or something like that.

For example:
I'll use a textbox control array.  I have 5 people I want to sent email to, so I create 5 textboxes called "Text" and add the names of the recepients into each textbox.  Then I loop through the textboxes then send the email.
Use of the MAPIMessages.RecipIndex allows this.
Text(1) = "TestUser@somewhere.com"
Text(2) = "TestUser2@somewhere.com"
and so on...

code looks like this:

---------------------------------------------------------
dim i as integer
dim strEmailMessage as string

MAPISession1.LogonUI = False
MAPISession1.UserName = "MICROSOFT OUTLOOK"
MAPISession1.SignOn
MAPIMessages.SessionID = MAPISession1.SessionID
MAPIMessages.Compose
For i = 0 To Text.Count - 1
    MAPIMessages.RecipIndex = MAPIMessages.RecipCount
    MAPIMessages.RecipDisplayName = Text(i)
    MAPIMessages.RecipAddress = Text(i)
    MAPIMessages.ResolveName
    MAPIMessages.RecipType = mapBccList
Next i
MAPIMessages.MsgNoteText = strEmailMessage
MAPIMessages.Send False
MAPISession1.SignOff

---------------------------------------------------------

I told you that the "3" was for Bcc and that is correct but you can also use the mapBccList to make it easier to understand.
mapToList = Primary recepient
mapCcList = Carbon copy recepients
mapBccList = Blind Carbon copy recepients

Later...
0
 

Author Comment

by:davtoche
ID: 6396364
thnk you ranger2
i didn't try but i'm sure it'll work
Talk to you soon for sthing else
David
0
 

Expert Comment

by:Nilesh Havire
ID: 31386693
can we sent the mail to,cc,bcc recipient at same time
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

685 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