简体   繁体   中英

Including multiple CC's in an Outlook Mail

I have a program that sends and email out to user when they have been added in.

I want the email to cc in multiple members of the IT team, however, I can only get it to CC to one person.

Below is my code:

                objMail = CType(objOutlook.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)

                ' Set the properties of the email.
                With objMail
                    .Subject = "Website Credentials"
                    .To = "chris.downs@test.com"
                    .CC = "benji@test.com, Alicia@test.com"
                    .Body = "Hi"
                    .Send()
                End With

This causes the email not to send at all. I have also attempted the below and this only CC's the last person not both.

                ' Set the properties of the email.
                With objMail
                    .Subject = "Website Credentials"
                    .To = "chris.downs@test.com"
                    .CC = "benji@test.com"
                    .CC = "Alicia@test.com"
                    .Body = "Hi"
                    .Send()
                End With

Is there a simple way of doing this that I'm missing?

Outlook, unlike standard email clients, separates entries on the TO, CC, and BCC lines with ; , not , . Change your CC line to

.CC = "benji@test.com; Alicia@test.com"

and it should send to both.

Your first try wasnt that bad. Just replace the comma with a semicolon. I think it should work like this

    .CC = "benji@test.com; Alicia@test.com"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM