Provides properties and methods for managing and examining the collection of the EmailAddress objects.
For a list of all members of this type, see EmailAddressCollection Members.
System.Object
System.Collections.CollectionBase
MailBee.Mime.EmailAddressCollection
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
EmailAddressCollection of EmailAddress objects stores multiple e-mail addresses (such as the list of To, CC or BCC recipients).
In the most cases, the developer does not need to directly create an EmailAddress to specify e-mail addresses because the most methods and properties which deal with e-mail addresses also accept string inputs as e-mail address values.
EmailAddressCollection class offers AsString property for this. For instance, to specify MailMessage.To as a string, set msg.To.AsString value (assuming msg is MailMessage instance).
This sample loads the message from .EML file and displays the e-mail address of each message recipient.
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class) // Load the message from file. MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\TestMail.eml"); // For every recipient... foreach (EmailAddress adr in msg.To) { // Show full information about the recipient's e-mail address. Console.WriteLine("Recipient name: " + adr.DisplayName); Console.WriteLine("Recipient address: " + adr.Email); Console.WriteLine("Recipient info: " + adr.Remarks); Console.WriteLine("Account name: " + adr.GetAccountName()); Console.WriteLine("Domain name: " + adr.GetDomain()); }
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Mime ' The actual code (put it into a method of your class) ' Load the message from file. Dim msg As New MailMessage msg.LoadMessage("C:\Docs\TestMail.eml") ' For every recipient... For Each adr As EmailAddress In msg.To ' Show full information about the recipient's e-mail address. Console.WriteLine("Recipient name: " & adr.DisplayName) Console.WriteLine("Recipient address: " & adr.Email) Console.WriteLine("Recipient info: " & adr.Remarks) Console.WriteLine("Account name: " & adr.GetAccountName()) Console.WriteLine("Domain name: " & adr.GetDomain()) Next
Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll)
EmailAddressCollection Members | MailBee.Mime Namespace | MailMessage | EmailAddress