EmailAddressCollectionAdd Method (EmailAddressCollection) |
Namespace: MailBee.MimeAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax Exceptions Examples This sample creates a new collection of the e-mail addresses and populates it with some addresses, loads the message from .EML file,
and adds this collection to the message recipients collection.
using MailBee;
using MailBee.Mime;
EmailAddressCollection adrs = new EmailAddressCollection();
adrs.AddFromString("User1 <user1@domain.com>");
adrs.Add("user2@domain.com");
MailMessage msg = new MailMessage();
msg.To.Add(adrs);
foreach (EmailAddress adr in adrs)
{
Console.WriteLine(adr.Email);
}
Imports MailBee
Imports MailBee.Mime
Dim adrs = New EmailAddressCollection
adrs.AddFromString("User1 <user1@domain.com>")
adrs.Add("user2@domain.com")
Dim msg As New MailMessage
msg.To.Add(adrs)
For Each adr As EmailAddress In adrs
Console.WriteLine(adr.Email)
Next
See Also