EmailAddressCollectionAsString Property |
Namespace: MailBee.Mime
Another way of adding e-mail addresses to the collection is using Add(EmailAddress) 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.
// 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); }