MailBee.NET Objects 4.0

EmailAddressCollection.Add Method (EmailAddress)

Adds the specified EmailAddress object to the collection.

public void Add(
   EmailAddress address
);

Parameters

address
The EmailAddress object to be added.

Exceptions

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

Example

This sample loads creates new message and adds a recipient to this message as a new EmailAddress object.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

MailMessage msg = new MailMessage();

// Set a new e-mail address.
EmailAddress adr = new EmailAddress("john_doe@domain.com");

// Add the e-mail address to the list of the recipients.
msg.To.Add(adr);
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

Dim msg As New MailMessage

' Set a new e-mail address.
Dim adr As EmailAddress = New EmailAddress("john_doe@domain.com")

' Add the e-mail address to the list of the recipients.
msg.To.Add(adr)

See Also

EmailAddressCollection Class | MailBee.Mime Namespace | EmailAddressCollection.Add Overload List | EmailAddress