Adds the specified full e-mail addresses (including display name if any) to the collection.
For instance, if the string is "John Doe" <j.doe@domain.com> (ABC Company), a single EmailAddress object will be appended to the collection and its DisplayName property will be set to John Doe, Remarks property will be set to ABC Company, and the Email property will be set to j.doe@domain.com value.
| Exception Type | Condition |
|---|---|
| MailBeeInvalidArgumentException | address is a null reference (Nothing in Visual Basic). |
This sample creates the new message and adds the new recipient's e-mail address 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 the mail address to the collection. msg.To.AddFromString("John Doe <jdoe@domain.com> (ABC Company)");
[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 the mail address to the collection. msg.To.AddFromString("John Doe <jdoe@domain.com> (ABC Company)")
EmailAddressCollection Class | MailBee.Mime Namespace | AsString | Parse