Solved

using mapi with visual basic

Posted on 2001-08-16
6
536 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
[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
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

707 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