Adds the specified EmailAddress object to the collection.
| Exception Type | Condition |
|---|---|
| MailBeeInvalidArgumentException | address is a null reference (Nothing in Visual Basic). |
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)
EmailAddressCollection Class | MailBee.Mime Namespace | EmailAddressCollection.Add Overload List | EmailAddress