?
Solved

using mapi with visual basic

Posted on 2001-08-16
6
Medium Priority
?
545 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 1

Accepted Solution

by:
Ranger2081200 earned 400 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…

771 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