MailBee.NET Objects 4.0

EmailAddress.AsString Property

Gets or sets the full e-mail address (with optional remarks and display name) as a string.

public string AsString {get; set;}

Property Value

A string containing all the full e-mail address (including display name and remarks if availalble).

Remarks

Typical values you can assign to this property:

Once this property is set, the DisplayName, Email and Remarks property values will be updated as well.

Example

This sample creates a new instance of the EmailAddress object and displays the actual e-mail address part (without display name, etc).

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

EmailAddress adr = new EmailAddress();

// Set e-mail.
adr.AsString = "\"John Doe\" <jdoe@domain.com>";

// Show the actual e-mail address without any additional information.
Console.WriteLine(adr.Email);

// As a result, "jdoe@domain.com" string will be printed in the console window.
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

' Create new EmailAddress object.
Dim adr = New EmailAddress

' Set e-mail.
adr.AsString = """John Doe"" <jdoe@domain.com>"

' Show the actual e-mail address without any additional information.
Console.WriteLine(adr.Email)

' As a result, "jdoe@domain.com" string will be printed in the console window.

See Also

EmailAddress Class | MailBee.Mime Namespace | Email | DisplayName