Solved

sending messages in visual basic

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

726 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