EmailAddressCollection.Add Method (String, String)
EmailAddressCollectionAdd Method (String, String)
Adds the e-mail address (specified as actual e-mail address and display name parts) to the collection.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public void Add(
	string email,
	string name


Type: SystemString
The actual e-mail address (such as
Type: SystemString
The name which is displayed with the actual e-mail address (such as John Doe). If a null reference (Nothing in Visual Basic), no display name will be assigned to the e-mail address.
MailBeeInvalidArgumentExceptionemail is a null reference (Nothing in Visual Basic).
This sample creates a new message and adds a recipient to this message.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// Create a new MailMessage object.
MailMessage msg = new MailMessage();

// Add a new mail address to the collection.
msg.To.Add("", "John Doe");
See Also