Solved

sending messages in visual basic

Posted on 2003-11-03
1
399 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

743 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

12 Experts available now in Live!

Get 1:1 Help Now