MailBee.NET Objects 4.0

EmailAddressCollection.AddFromString Method 

Adds the specified full e-mail addresses (including display name if any) to the collection.

public void AddFromString(
   string addressString
);

Parameters

addressString
The string containing the full e-mail addresses delimited with comma (,) or semicolon (;).

Remarks

For instance, if the string is "John Doe" <j.doe@domain.com> (ABC Company), a single EmailAddress object will be appended to the collection and its DisplayName property will be set to John Doe, Remarks property will be set to ABC Company, and the Email property will be set to j.doe@domain.com value.

Exceptions

Exception TypeCondition
MailBeeInvalidArgumentExceptionaddress is a null reference (Nothing in Visual Basic).

Example

This sample creates the new message and adds the new recipient's e-mail address to this message.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// Create a new MailMessage object.
MailMessage msg = new MailMessage();

// Add the mail address to the collection.
msg.To.AddFromString("John Doe <jdoe@domain.com> (ABC Company)");
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

' Create a new MailMessage object.
Dim msg As New MailMessage

' Add the mail address to the collection.
msg.To.AddFromString("John Doe <jdoe@domain.com> (ABC Company)")

See Also

EmailAddressCollection Class | MailBee.Mime Namespace | AsString | Parse