Adds the specified e-mail address to the collection.
To add a full e-mail address (such as "John Doe, Jr." <jdoe@domain.com>), the developer can use AddFromString method.
| Exception Type | Condition |
|---|---|
| MailBeeInvalidArgumentException | email is a null reference (Nothing in Visual Basic). |
This sample creates a new message and adds a recipient to this message.
[C#] // 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 "To:" collection. msg.To.Add("john_doe@domain.com");
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Mime ' Create a new MailMessage object. Dim msg As New MailMessage ' Add a new mail address to the "To:" collection. msg.To.Add("john_doe@domain.com")
EmailAddressCollection Class | MailBee.Mime Namespace | EmailAddressCollection.Add Overload List | AddFromString