MailBee.NET Objects 7.1

EmailAddress.GetDomainFromEmail Method 

Gets the domain name of the specified e-mail address as a string.

public static string GetDomainFromEmail(
   string email
);

Parameters

email
The e-mail address as a string.

Remarks

For instance, the domain value will be returned for the account@domain.com e-mail address. To get the account name from specified e-mail address the developer should use the GetAccountNameFromEmail method of the EmailAddress object.

To get an account name part or domain part of the existing EmailAddress object, the developer can use GetAccountName or GetDomain methods.

Example

This sample extracts the account and domain names from the specified e-mail address.

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

Console.WriteLine(EmailAddress.GetAccountNameFromEmail("user1@domain.com"));
Console.WriteLine(EmailAddress.GetDomainFromEmail("user1@domain.com"));
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

Console.WriteLine(EmailAddress.GetAccountNameFromEmail("user1@domain.com"))
Console.WriteLine(EmailAddress.GetDomainFromEmail("user1@domain.com"))

See Also

EmailAddress Class | MailBee.Mime Namespace | GetDomain | GetAccountNameFromEmail