Solved

using mapi with visual basic

Posted on 2001-08-16
6
497 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now