vb.netemailoutlookcarbon-copy

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?


Solution

  • 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.