MailBee.NET Objects 7.2

MailMessage.Cc Property

Gets or sets the list of carbon copy (CC) recipients of the message.

public EmailAddressCollection Cc {get; set;}

Property Value

An EmailAddressCollection object containing a collection of e-mail addresses of carbon copy recipients of the message. The default value is an empty collection.

Remarks

To specify Cc as a string, set msg.Cc.AsString value (assuming msg is MailMessage instance).

If it's necessary to add some hidden recipients that should not be displayed in the mail message, the developer should use the Bcc property.

Exceptions

Exception Type Condition
MailBeeInvalidArgumentException value is a null reference (Nothing in Visual Basic).

Example

This sample loads the message from .EML file and displays the e-mail addresses of CC recipients.

[C#]
using System;
using MailBee;
using MailBee.Mime;

class Sample
{
    static void Main(string[] args)
    {
        // Load the message from file.
        MailMessage msg = new MailMessage();
        msg.LoadMessage(@"C:\Docs\TestMail.eml");

        Console.WriteLine("The list of CC recipients of the message:");

        // For each carbon copy recipient...
        foreach (EmailAddress adr in msg.Cc)
        {
            // ...show e-mail address.
            Console.WriteLine(adr.Email);
        }
    }
}
[Visual Basic]
Imports System
Imports MailBee
Imports MailBee.Mime

Module Sample
    Sub Main(ByVal args As String())
        ' Load the message from file.
        Dim msg As New MailMessage
        msg.LoadMessage("C:\Docs\TestMail.eml")

        Console.WriteLine("The list of CC recipients of the message:")

        ' For each carbon copy recipient...
        For Each adr As EmailAddress In msg.Cc
            ' ...show e-mail address.
            Console.WriteLine(adr.Email)
        Next
    End Sub
End Module

See Also

MailMessage Class | MailBee.Mime Namespace | EmailAddressCollection | Bcc