Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

sending messages in visual basic

Posted on 2003-11-03
1
Medium Priority
?
411 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 150 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

636 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