Gets or sets all the e-mail addresses in the collection as a string.
A string containing all the full e-mail addresses in the collection (with display names and remarks if any).
Another way of adding e-mail addresses to the collection is using Add method.
The e-mail addresses will be delimited with comma (,). However, if the given collection belongs to the MailMessage object (for instance, represents To property), the delimiter in the output string will be either comma (,) or semicolon (;) depending on MailMessage.Builder.AddressDelimeter property value. Anyway, when parsing an e-mail address string rather than building it, both comma and semicolon are recognized as valid delimiters.
This sample creates a new collection of e-mail addresses and displays each address from this collection.
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; EmailAddressCollection adrs = new EmailAddressCollection("jdoe@domain1.com, some one <someone@domain2.com>, me@host.com (Comment)"); adrs.AsString = @"user1@domain.com, ""User 2"" <user2@domain.com>, user3@domain.com (Domain Company, LLC)"; foreach (EmailAddress address in adrs) { Console.WriteLine(address.Email); }
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Mime Dim adrs As EmailAddressCollection = New EmailAddressCollection("jdoe@domain1.com, some one <someone@domain2.com>, me@host.com (Comment)") adrs.AsString = "user1@domain.com, ""User 2"" <user2@domain.com>, user3@domain.com (Domain Company, LLC)" For Each address As EmailAddress In adrs Console.WriteLine(address.Email) Next
EmailAddressCollection Class | MailBee.Mime Namespace | Add