MailBee.NET Objects 7.1

EmailAddress.GetAccountName Method 

Gets the account name of the e-mail address.

public string GetAccountName();

Return Value

A string containing the account name of the e-mail address.

Remarks

For instance, the account value will be returned for the account@domain.com e-mail. To get the domain name, the developer should use the GetDomain method.

To extract account name from the supplied e-mail address without creating an instance of EmailAddress class, use GetAccountNameFromEmail method.

Example

This sample creates a new e-mail address and displays the account name of this address.

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

EmailAddress adr = new EmailAddress();

// Add display name.
adr.DisplayName = "John Doe";

// Add e-mail address.
adr.Email = "jdoe@domain.com";

// Add remarks.
adr.Remarks = "ABC Company";

// Show account name string.
Console.WriteLine(adr.GetAccountName());
[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 As New EmailAddress

' Add display name.
adr.DisplayName = "John Doe"

' Add e-mail address.
adr.Email = "jdoe@domain.com"

' Add remarks.
adr.Remarks = "ABC Company"

' Show account name string.
Console.WriteLine(adr.GetAccountName())

See Also

EmailAddress Class | MailBee.Mime Namespace | GetDomain | GetAccountNameFromEmail