Solved

sending messages in visual basic

Posted on 2003-11-03
1
408 Views
Last Modified: 2013-11-25
to send mail from one of our application we wrote the following code


Private Function sendEmail(strEmailTo As String, strCCMailTo As String,
                                        strBCCMailTo As String, strSubject As String,
                                        strMessage As String, strAttachment As String)
On Error GoTo ErrHandler
    objSession.SignOn
    With objMessage
        .SessionID = objSession.SessionID
        .Compose
        .MsgSubject = strSubject
        .RecipDisplayName = strEmailTo
        .ResolveName
        .MsgNoteText = strMessage
        .AttachmentIndex = 0
        .AttachmentPosition = 0
        .AttachmentPathName = strAttachment
        .Send
        FileSystem.Kill (strAttachment)
    End With
    objSession.SignOff
Exit Function
ErrHandler:
    DisplayErrMessage Me.Caption, "sendEmail", Err.Number, Err.Description
End Function

now we want to send certain messages as cc to and bcc to

how do we do that

0
Comment
Question by:alifyusuf
[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
1 Comment
 
LVL 53

Accepted Solution

by:
Dhaest earned 50 total points
ID: 9669996
CC and BCC are available fromthe MAPI interface.

You need to change the .RecipType

Here is how we do it
rCount/ccCount/bccCount - Number of each recipient type
rAddress/ccAddress/bccAddress - Arrays with the addresses
    For i = 0 To rCount - 1  
        With mapMess
            .RecipType = 1
            .RecipIndex = i
            .RecipAddress = rAddress(i)
            .ResolveName
        End With
    Next i
    'Set up the CC line
    For i = 0 To ccCount - 1
        With mapMess
            .RecipType = 2
            .RecipIndex = rCount + i
            .RecipAddress = ccAddress(i)
            .ResolveName
        End With
    Next i
    'Set up the BCC line
    For i = 0 To bccCount - 1
        With mapMess
            .RecipType = 3
            .RecipIndex = rCount + ccCount + i
            .RecipAddress = bccAddress(i)
            .ResolveName
        End With
    Next i


You better use this free control. CC and BCC are features of it: http://www.freevbcode.com/ShowCode.Asp?ID=109 

0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to measure sizes and angles in scanned images ? 3 99
Macro Excel - Multiple If conditions 2 93
Problem to With line 4 86
MS Access 03, TransferText, decimal places 8 91
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

737 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