Solved

sending messages in visual basic

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
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…

831 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