EmailAddressCollectionRemove Method |
Namespace: MailBee.Mime
Exception | Condition |
---|---|
MailBeeInvalidArgumentException | email is a null reference (Nothing in Visual Basic). |
If the specified e-mail address appears multiple times in the collection, all such entries will be removed.
To remove the e-mail address from the collection by the index, the developer should use RemoveAt(Int32) method.
// To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; MailMessage msg = new MailMessage(); msg.To.Add("user1@domain.com"); msg.To.Add("user2@domain.com", "User 2"); msg.To.Add("user3@domain.com", null, "User 3"); Console.WriteLine(msg.To.ToString()); msg.To.Remove("user2@domain.com"); Console.WriteLine(msg.To.ToString());