ComponentSpace.EmailChecker

ComponentSpace Email Checker Class Library Reference

ComponentSpace.EmailChecker Namespace

The ComponentSpace.EmailChecker namespace contains classes that support email address validation.

Namespace hierarchy

Classes

Class | Description
CheckCompletedEventArgs | Provides data for the CheckCompleted event.
EmailAddressChecker | Validate email addresses.
EmailCheckerException | The exception that is thrown when an email check operation fails.
Mailbox | Parse an email address into its constituent parts and verify its syntax as described by RFC-2822.
MailServer | Validate email addresses against an SMTP mail server.

Delegates

Delegate | Description
CheckCompletedEventHandler | Represents the method that will handle the CheckCompleted event.

Enumerations

Enumeration | Description
EmailCheck | The type of email address check to perform.
EmailCheckResult | The result of the email address check.


CheckCompletedEventArgs Class

Provides data for the CheckCompleted event.

For a list of all members of this type, see CheckCompletedEventArgs Members.

System.Object
System.EventArgs
ComponentSpace.EmailChecker.CheckCompletedEventArgs

[Visual Basic]
Public Class CheckCompletedEventArgs
Inherits EventArgs
[C#]
public class CheckCompletedEventArgs : EventArgs

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The CheckCompleted event is raised by the EmailAddressChecker. It contains all the information needed to complete the asynchronous check operation.

Requirements

Namespace: ComponentSpace.EmailChecker

Assembly: ComponentSpace.EmailChecker (in ComponentSpace.EmailChecker.dll)

See Also

CheckCompletedEventArgs Members | ComponentSpace.EmailChecker Namespace


CheckCompletedEventArgs Members

CheckCompletedEventArgs overview

Public Instance Properties

AsyncResult Gets the result of the asynchronous receive operation.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

CheckCompletedEventArgs Class | ComponentSpace.EmailChecker Namespace


CheckCompletedEventArgs Properties

The properties of the CheckCompletedEventArgs class are listed below. For a complete list of CheckCompletedEventArgs class members, see the CheckCompletedEventArgs Members topic.

Public Instance Properties

AsyncResult Gets the result of the asynchronous receive operation.

See Also

CheckCompletedEventArgs Class | ComponentSpace.EmailChecker Namespace


CheckCompletedEventArgs.AsyncResult Property

Gets the result of the asynchronous receive operation.

[Visual Basic]
Public ReadOnly Property AsyncResult As IAsyncResult
[C#]
public System.IAsyncResult AsyncResult {get;}

Property Value

An IAsyncResult that contains the data associated with the check operation.

Remarks

AsyncResult identifies ongoing or completed asynchronous operations. The property contains data that helps determine which of several potential asynchronous operations to complete, and when passed to the event handler, enables EndCheck to access the results associated with the completed operation.

See Also

CheckCompletedEventArgs Class | ComponentSpace.EmailChecker Namespace


CheckCompletedEventHandler Delegate

Represents the method that will handle the CheckCompleted event.

[Visual Basic]
Public Delegate Sub CheckCompletedEventHandler( _
ByVal sender As Object, _
ByVal e As CheckCompletedEventArgs _
)
[C#]
public delegate void CheckCompletedEventHandler(
object sender,
CheckCompletedEventArgs e
);

Parameters

sender
The source of the event.
e
A CheckCompletedEventArgs that contains the event data.

Remarks

When you create a CheckCompletedEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate.

Requirements

Namespace: ComponentSpace.EmailChecker

Assembly: ComponentSpace.EmailChecker (in ComponentSpace.EmailChecker.dll)

See Also

ComponentSpace.EmailChecker Namespace


EmailAddressChecker Class

Validate email addresses.

For a list of all members of this type, see EmailAddressChecker Members.

System.Object
ComponentSpace.EmailChecker.EmailAddressChecker

[Visual Basic]
Public Class EmailAddressChecker
[C#]
public class EmailAddressChecker

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The type of email address check may be specified using EmailCheck. You can check the syntax only, validate the domain name, and validate the email address against the domain's mail server.

Checking the syntax is the fastest check as it doesn't require communicating with a remote server. All email address formats, as specified by RFC-2822, are supported. For example, the following are valid email addresses:

  • support@componentspace.com
  • "ComponentSpace Support" <support@componentspace.com>
  • "ComponentSpace Support" (we always do our best!) <support@componentspace.com>
  • "ComponentSpace Support" <support@[66.210.153.10]>

Validating the domain name involves communicating with the domain's DNS server and retrieving the MX records that list the domain's mail servers.

Validating the email address involves communicating with the mail server using SMTP (RFC-2821) to attempt to determine whether the email address is valid. No email is sent to the user. Please note that although the SMTP check can determine whether an email address is bad it cannot guarantee an address is valid as not all mail servers provide notification of invalid user names.

The email check may occur synchronously (blocking) using Check, or asynchronously (non-blocking) using BeginCheck and EndCheck.

If you're behind a firewall you must ensure outgoing UDP traffic to port 53 (the default DNS port) and outgoing TCP traffic to port 25 (the default SMTP port) is permitted.

Requirements

Namespace: ComponentSpace.EmailChecker

Assembly: ComponentSpace.EmailChecker (in ComponentSpace.EmailChecker.dll)

See Also

EmailAddressChecker Members | ComponentSpace.EmailChecker Namespace


EmailAddressChecker Members

EmailAddressChecker overview

Public Instance Constructors

EmailAddressChecker Constructor Initializes a new instance of the EmailAddressChecker.

Public Instance Properties

DnsServerAddress | Gets or sets the DNS server address to use when checking the domain name. If this value isn't specified then the default local DNS server is used.
EmailCheck | Gets or sets the type of email address check to perform.
ErrorMessage | Get the error text associated with checking the email address.
FromEmailAddress | Gets or sets the from email address. If a User check is being performed the from email address is used when communicating with the email server. Typically the default value is sufficient.
SynchronizingObject | Gets or sets the synchonizing object for receiving events.
Timeout | Gets or sets the number of milliseconds to wait for the email address check to complete.

Public Instance Methods

BeginCheck | Overloaded. Initiates an asynchronous email address check operation.
Check | Check the validity of the email address.
EndCheck | Completes the specified asynchronous check operation.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Public Instance Events

CheckCompleted Occurs when the email address check has completed.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker Constructor

Initializes a new instance of the EmailAddressChecker.

[Visual Basic]
Public Sub New()
[C#]
public EmailAddressChecker();

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker Properties

The properties of the EmailAddressChecker class are listed below. For a complete list of EmailAddressChecker class members, see the EmailAddressChecker Members topic.

Public Instance Properties

DnsServerAddress | Gets or sets the DNS server address to use when checking the domain name. If this value isn't specified then the default local DNS server is used.
EmailCheck | Gets or sets the type of email address check to perform.
ErrorMessage | Get the error text associated with checking the email address.
FromEmailAddress | Gets or sets the from email address. If a User check is being performed the from email address is used when communicating with the email server. Typically the default value is sufficient.
SynchronizingObject | Gets or sets the synchonizing object for receiving events.
Timeout | Gets or sets the number of milliseconds to wait for the email address check to complete.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker.DnsServerAddress Property

Gets or sets the DNS server address to use when checking the domain name. If this value isn't specified then the default local DNS server is used.

[Visual Basic]
Public Property DnsServerAddress As String
[C#]
public string DnsServerAddress {get; set;}

Property Value

The DNS server address (eg. 66.210.153.10 or www.componentspace.com) or null if the default local DNS server is to be used.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker.EmailCheck Property

Gets or sets the type of email address check to perform.

[Visual Basic]
Public Property EmailCheck As EmailCheck
[C#]
public EmailCheck EmailCheck {get; set;}

Property Value

The type of email address check to perform. The default is User

Remarks

You can either check the syntax only (Syntax), validate the syntax and domain name (Domain), or validate the syntax, domain name and the email address against the mail server (User).

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker.ErrorMessage Property

Get the error text associated with checking the email address.

[Visual Basic]
Public ReadOnly Property ErrorMessage As String
[C#]
public string ErrorMessage {get;}

Property Value

The error text associated with checking the email address or a null reference (Nothing in Visual Basic) if no error occurred.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker.FromEmailAddress Property

Gets or sets the from email address. If a User check is being performed the from email address is used when communicating with the email server. Typically the default value is sufficient.

[Visual Basic]
Public Property FromEmailAddress As String
[C#]
public string FromEmailAddress {get; set;}

Property Value

The from email address. The default is support@componentspace.com.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker.SynchronizingObject Property

Gets or sets the synchonizing object for receiving events.

[Visual Basic]
Public Property SynchronizingObject As ISynchronizeInvoke
[C#]
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject {get; set;}

Property Value

An ISynchronizeInvoke, which represents the object that marshals the event-handler call resulting from a CheckCompleted event. The default is a null reference (Nothing in Visual Basic).

Remarks

A CheckCompleted event results from a BeginCheck request to a specific thread. Typically, the SynchronizingObject is set when it's used within a form, because forms are bound to a specific thread.

Typically, the synchronizing object marshals a method call into a single thread.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker.Timeout Property

Gets or sets the number of milliseconds to wait for the email address check to complete.

[Visual Basic]
Public Property Timeout As Integer
[C#]
public int Timeout {get; set;}

Property Value

The number of milliseconds to wait for the email address check to complete. The default is 60 seconds.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker Methods

The methods of the EmailAddressChecker class are listed below. For a complete list of EmailAddressChecker class members, see the EmailAddressChecker Members topic.

Public Instance Methods

BeginCheck | Overloaded. Initiates an asynchronous email address check operation.
Check | Check the validity of the email address.
EndCheck | Completes the specified asynchronous check operation.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


BeginCheck Method

ComponentSpace Email Checker Class Library Reference

EmailAddressChecker.BeginCheck Method

Initiates an asynchronous email address check operation.

Overload List

Initiates an asynchronous email address check operation.

public IAsyncResult BeginCheck(string);

Initiates an asynchronous email address check operation that has a specified state object.

public IAsyncResult BeginCheck(string,object);

Initiates an asynchronous email address check operation that has a specified state object. This overload receives notification, through a callback, of the identity of the event handler for this operation.

public IAsyncResult BeginCheck(string,object,AsyncCallback);

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker.BeginCheck Method (String)

Initiates an asynchronous email address check operation.

[Visual Basic]
Overloads Public Function BeginCheck( _
ByVal emailAddress As String _
) As IAsyncResult
[C#]
public IAsyncResult BeginCheck(
string emailAddress
);

Parameters

emailAddress
The email address to check (eg. support@componentspace.com).

Return Value

The IAsyncResult that identifies the posted asynchronous request.

Remarks

In asynchronous processing, you use BeginCheck to raise the CheckCompleted event when the check operation has completed.

To use BeginCheck, create an event handler that processes the results of the asynchronous operation and associate it with your event delegate. BeginCheck initiates an asynchronous check operation; the EmailAddressChecker is notified, through the raising of the CheckCompleted event, when the check operation is completed. The EmailAddressChecker can then access the check status by calling EndCheck.

Note: The BeginCheck method returns immediately, but the asynchronous operation is not completed until the event handler is called.

Because BeginCheck is asynchronous, you can call it to receive the check status without blocking the current thread of execution. To synchronously check, use the Check method.

Once an asynchronous operation completes, you can call BeginCheck again in the event handler to keep receiving notifications.

The IAsyncResult that BeginCheck returns identifies the asynchronous operation that the method call started. You can use this IAsyncResult throughout the lifetime of the operation, although you generally do not use it until EndCheck is called. However, if you start several asynchronous operations, you can place their IAsyncResult values in an array and specify whether to wait for all operations or any operation to complete. In this case, you use the AsyncWaitHandle property of the IAsyncResult to identify the completed operation.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace | EmailAddressChecker.BeginCheck Overload List


EmailAddressChecker.BeginCheck Method (String, Object)

Initiates an asynchronous email address check operation that has a specified state object.

[Visual Basic]
Overloads Public Function BeginCheck( _
ByVal emailAddress As String, _
ByVal stateObject As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginCheck(
string emailAddress,
object stateObject
);

Parameters

emailAddress
The email address to check (eg. support@componentspace.com).
stateObject
A state object, specified by the application, that contains information associated with the asynchronous operation.

Return Value

The IAsyncResult that identifies the posted asynchronous request.

Remarks

In asynchronous processing, you use BeginCheck to raise the CheckCompleted event when the check operation has completed.

Use this overload to associate information with the operation that will be preserved throughout the operation's lifetime. The event handler can detect this information by looking at the AsyncState of the IAsyncResult that is associated with the operation.

To use BeginCheck, create an event handler that processes the results of the asynchronous operation and associate it with your event delegate. BeginCheck initiates an asynchronous check operation; the EmailAddressChecker is notified, through the raising of the CheckCompleted event, when the check operation is completed. The EmailAddressChecker can then access the check status by calling EndCheck.

Note: The BeginCheck method returns immediately, but the asynchronous operation is not completed until the event handler is called.

Because BeginCheck is asynchronous, you can call it to receive the check status without blocking the current thread of execution. To synchronously check, use the Check method.

Once an asynchronous operation completes, you can call BeginCheck again in the event handler to keep receiving notifications.

The IAsyncResult that BeginCheck returns identifies the asynchronous operation that the method call started. You can use this IAsyncResult throughout the lifetime of the operation, although you generally do not use it until EndCheck is called. However, if you start several asynchronous operations, you can place their IAsyncResult values in an array and specify whether to wait for all operations or any operation to complete. In this case, you use the AsyncWaitHandle property of the IAsyncResult to identify the completed operation.

The state object associates state information with the operation. For example, if you call BeginCheck multiple times to initiate multiple operations, you can identify each operation through a separate state object that you define.

You can also use the state object to pass information across process threads. If a thread is started but the callback is on a different thread in an asynchronous scenario, the state object is marshaled and passed back along with information from the event.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace | EmailAddressChecker.BeginCheck Overload List


EmailAddressChecker.BeginCheck Method (String, Object, AsyncCallback)

Initiates an asynchronous email address check operation that has a specified state object. This overload receives notification, through a callback, of the identity of the event handler for this operation.

[Visual Basic]
Overloads Public Function BeginCheck( _
ByVal emailAddress As String, _
ByVal stateObject As Object, _
ByVal asyncCallback As AsyncCallback _
) As IAsyncResult
[C#]
public IAsyncResult BeginCheck(
string emailAddress,
object stateObject,
AsyncCallback asyncCallback
);

Parameters

emailAddress
The email address to check (eg. support@componentspace.com).
stateObject
A state object, specified by the application, that contains information associated with the asynchronous operation.
asyncCallback
The AsyncCallback that will receive the notification of the asynchronous operation completion.

Return Value

The IAsyncResult that identifies the posted asynchronous request.

Remarks

When you use this overload, the callback specified in the callback parameter is invoked directly when the check operation has completed; the CheckCompleted event is not raised. The other overloads of BeginCheck rely on this component to raise the CheckCompleted event.

To use BeginCheck, define an asynchronous callback method. BeginCheck initiates an asynchronous check operation; the EmailAddressChecker is notified, through a call to the callback method, when the check operation is completed. The EmailAddressChecker can then access the check status by calling EndCheck.

Use this overload to associate information with the operation that will be preserved throughout the operation's lifetime. The event handler can detect this information by looking at the AsyncState of the IAsyncResult that is associated with the operation.

Note: The BeginCheck method returns immediately, but the asynchronous operation is not completed until the event handler is called.

Because BeginCheck is asynchronous, you can call it to receive the check status without blocking the current thread of execution. To synchronously check, use the Check method.

Once an asynchronous operation completes, you can call BeginCheck again in the event handler to keep receiving notifications.

The IAsyncResult that BeginCheck returns identifies the asynchronous operation that the method call started. You can use this IAsyncResult throughout the lifetime of the operation, although you generally do not use it until EndCheck is called. However, if you start several asynchronous operations, you can place their IAsyncResult values in an array and specify whether to wait for all operations or any operation to complete. In this case, you use the AsyncWaitHandle property of the IAsyncResult to identify the completed operation.

The state object associates state information with the operation. For example, if you call BeginCheck multiple times to initiate multiple operations, you can identify each operation through a separate state object that you define.

You can also use the state object to pass information across process threads. If a thread is started but the callback is on a different thread in an asynchronous scenario, the state object is marshaled and passed back along with information from the event.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace | EmailAddressChecker.BeginCheck Overload List


EmailAddressChecker.Check Method

Check the validity of the email address.

[Visual Basic]
Public Function Check( _
ByVal emailAddress As String _
) As EmailCheckResult
[C#]
public EmailCheckResult Check(
string emailAddress
);

Parameters

emailAddress
The email address to check (eg. support@componentspace.com).

Return Value

An EmailCheckResult indicating the result of the check.

Remarks

The EmailCheck determines the type of check to perform.

Exceptions

Exception Type | Condition
EmailCheckerException | Thrown when the email address check could not complete.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker.EndCheck Method

Completes the specified asynchronous check operation.

[Visual Basic]
Public Function EndCheck( _
ByVal asyncResult As IAsyncResult _
) As EmailCheckResult
[C#]
public EmailCheckResult EndCheck(
IAsyncResult asyncResult
);

Parameters

asyncResult
The IAsyncResult that identifies the asynchronous check operation to finish, and from which to retrieve an end result.

Return Value

An EmailCheckResult indicating the result of the check.

Remarks

When the CheckCompleted event is raised, EndCheck completes the operation that was initiated by the BeginCheck call.

Exceptions

Exception Type | Condition
EmailCheckerException | Thrown when the email address check could not complete.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker Events

The events of the EmailAddressChecker class are listed below. For a complete list of EmailAddressChecker class members, see the EmailAddressChecker Members topic.

Public Instance Events

CheckCompleted Occurs when the email address check has completed.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailAddressChecker.CheckCompleted Event

Occurs when the email address check has completed.

[Visual Basic]
Public Event CheckCompleted As CheckCompletedEventHandler
[C#]
public event CheckCompletedEventHandler CheckCompleted;

Event Data

The event handler receives an argument of type CheckCompletedEventArgs containing data related to this event. The following CheckCompletedEventArgs property provides information specific to this event.

Property | Description
AsyncResult | Gets the result of the asynchronous receive operation.

Remarks

BeginCheck is used in asynchronous processing to raise the CheckCompleted event when the email address check operation has completed.

EndCheck is used to complete the operation initiated by a call to BeginCheck and get the check status when the CheckCompleted event is raised.

See Also

EmailAddressChecker Class | ComponentSpace.EmailChecker Namespace


EmailCheck Enumeration

The type of email address check to perform.

[Visual Basic]
Public Enum EmailCheck
[C#]
public enum EmailCheck

Members

Member Name | Description
Syntax | Check the syntax only.
Domain | Check the syntax and ensure the domain name is valid.
User | Check the syntax, the domain name and validate the email address against the mail server.

Requirements

Namespace: ComponentSpace.EmailChecker

Assembly: ComponentSpace.EmailChecker (in ComponentSpace.EmailChecker.dll)

See Also

ComponentSpace.EmailChecker Namespace


EmailCheckerException Class

The exception that is thrown when an email check operation fails.

For a list of all members of this type, see EmailCheckerException Members.

System.Object
System.Exception
System.ApplicationException
ComponentSpace.EmailChecker.EmailCheckerException

[Visual Basic]
Public Class EmailCheckerException
Inherits ApplicationException
[C#]
public class EmailCheckerException : ApplicationException

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: ComponentSpace.EmailChecker

Assembly: ComponentSpace.EmailChecker (in ComponentSpace.EmailChecker.dll)

See Also

EmailCheckerException Members | ComponentSpace.EmailChecker Namespace


EmailCheckerException Members

EmailCheckerException overview

Public Instance Properties

HelpLink (inherited from Exception) | Gets or sets a link to the help file associated with this exception.
InnerException (inherited from Exception) | Gets the Exception instance that caused the current exception.
Message (inherited from Exception) | Gets a message that describes the current exception.
Source (inherited from Exception) | Gets or sets the name of the application or the object that causes the error.
StackTrace (inherited from Exception) | Gets a string representation of the frames on the call stack at the time the current exception was thrown.
TargetSite (inherited from Exception) | Gets the method that throws the current exception.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetBaseException (inherited from Exception) | When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetObjectData (inherited from Exception) | When overridden in a derived class, sets the SerializationInfo with information about the exception.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Exception) | Creates and returns a string representation of the current exception.

Protected Instance Properties

HResult (inherited from Exception) Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

EmailCheckerException Class | ComponentSpace.EmailChecker Namespace


EmailCheckResult Enumeration

The result of the email address check.

[Visual Basic]
Public Enum EmailCheckResult
[C#]
public enum EmailCheckResult

Members

Member Name | Description
NoErrors | No errors were detected.
BadSyntax | The syntax is invalid.
BadDomain | The domain name is invalid.
BadUser | The email address failed to validate against the mail server.

Requirements

Namespace: ComponentSpace.EmailChecker

Assembly: ComponentSpace.EmailChecker (in ComponentSpace.EmailChecker.dll)

See Also

ComponentSpace.EmailChecker Namespace


Mailbox Class

Parse an email address into its constituent parts and verify its syntax as described by RFC-2822.

For a list of all members of this type, see Mailbox Members.

System.Object
ComponentSpace.EmailChecker.Mailbox

[Visual Basic]
Public Class Mailbox
[C#]
public class Mailbox

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Paraphrasing RFC-2822, a mailbox address is specified as follows: mailbox = name-addr | addr-spec name-addr = [display-name] angle-addr angle-addr = [CFWS] "<" addr-spec ">" [CFWS] display-name = phrase CFWS = comment or a folding white space FWS = white space or CRLF comment = "(" text ")"

Requirements

Namespace: ComponentSpace.EmailChecker

Assembly: ComponentSpace.EmailChecker (in ComponentSpace.EmailChecker.dll)

See Also

Mailbox Members | ComponentSpace.EmailChecker Namespace


Mailbox Members

Mailbox overview

Public Static (Shared) Methods

StripComments Strip comments from an email address.

Public Instance Constructors

Mailbox Constructor Initializes a new instance of the Mailbox class with the specified email address (eg. support@componentspace.com).

Public Instance Properties

DisplayName | Get the display name. For example, the display name part of "ComponentSpace Support" <support@componentspace.com> is ComponentSpace Support.
DomainName | Get the domain name. For example, the domain part of "ComponentSpace Support" <support@componentspace.com> is componentspace.com.
FullAddress | Get the full email address.
LocalPart | Get the local part (ie. the user name). For example, the local part of "ComponentSpace Support" <support@componentspace.com> is support.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

Mailbox Class | ComponentSpace.EmailChecker Namespace


Mailbox Constructor

Initializes a new instance of the Mailbox class with the specified email address (eg. support@componentspace.com).

[Visual Basic]
Public Sub New( _
ByVal fullAddress As String _
)
[C#]
public Mailbox(
string fullAddress
);

Parameters

fullAddress
The email address.

Remarks

All email address formats, as specified by RFC-2822, are supported. For example, the following are valid email addresses:

  • support@componentspace.com
  • "ComponentSpace Support" <support@componentspace.com>
  • "ComponentSpace Support" (we always do our best!) <support@componentspace.com>
  • "ComponentSpace Support" <support@[66.210.153.10]>

See Also

Mailbox Class | ComponentSpace.EmailChecker Namespace


Mailbox Properties

The properties of the Mailbox class are listed below. For a complete list of Mailbox class members, see the Mailbox Members topic.

Public Instance Properties

DisplayName | Get the display name. For example, the display name part of "ComponentSpace Support" <support@componentspace.com> is ComponentSpace Support.
DomainName | Get the domain name. For example, the domain part of "ComponentSpace Support" <support@componentspace.com> is componentspace.com.
FullAddress | Get the full email address.
LocalPart | Get the local part (ie. the user name). For example, the local part of "ComponentSpace Support" <support@componentspace.com> is support.

See Also

Mailbox Class | ComponentSpace.EmailChecker Namespace


Mailbox.DisplayName Property

Get the display name. For example, the display name part of "ComponentSpace Support" <support@componentspace.com> is ComponentSpace Support.

[Visual Basic]
Public ReadOnly Property DisplayName As String
[C#]
public string DisplayName {get;}

Property Value

The display name.

See Also

Mailbox Class | ComponentSpace.EmailChecker Namespace


Mailbox.DomainName Property

Get the domain name. For example, the domain part of "ComponentSpace Support" <support@componentspace.com> is componentspace.com.

[Visual Basic]
Public ReadOnly Property DomainName As String
[C#]
public string DomainName {get;}

Property Value

The domain name.

See Also

Mailbox Class | ComponentSpace.EmailChecker Namespace


Mailbox.FullAddress Property

Get the full email address.

[Visual Basic]
Public ReadOnly Property FullAddress As String
[C#]
public string FullAddress {get;}

Property Value

The full email address.

See Also

Mailbox Class | ComponentSpace.EmailChecker Namespace


Mailbox.LocalPart Property

Get the local part (ie. the user name). For example, the local part of "ComponentSpace Support" <support@componentspace.com> is support.

[Visual Basic]
Public ReadOnly Property LocalPart As String
[C#]
public string LocalPart {get;}

Property Value

The local part (ie. user name).

See Also

Mailbox Class | ComponentSpace.EmailChecker Namespace


Mailbox Methods

The methods of the Mailbox class are listed below. For a complete list of Mailbox class members, see the Mailbox Members topic.

Public Static (Shared) Methods

StripComments Strip comments from an email address.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

Mailbox Class | ComponentSpace.EmailChecker Namespace


Mailbox.StripComments Method

Strip comments from an email address.

[Visual Basic]
Public Shared Function StripComments( _
ByVal text As String _
) As String
[C#]
public static string StripComments(
string text
);

Parameters

text
The text containing comments.

Return Value

The text with comments removed.

Remarks

Comments are enclosed in parentheses (eg. (ComponentSpace) support@componentspace.com is stripped to support@componentspace.com).

See Also

Mailbox Class | ComponentSpace.EmailChecker Namespace


MailServer Class

Validate email addresses against an SMTP mail server.

For a list of all members of this type, see MailServer Members.

System.Object
ComponentSpace.EmailChecker.MailServer

[Visual Basic]
Public Class MailServer
[C#]
public class MailServer

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The MailServer constructor specifies the address of the mail server. Optionally, the Timeout may be set. IsValidEmailAddress checks an email address against the mail server.

If you're behind a firewall you must ensure outgoing UDP traffic to port 53 (the default DNS port) and outgoing TCP traffic to port 25 (the default SMTP port) is permitted.

Requirements

Namespace: ComponentSpace.EmailChecker

Assembly: ComponentSpace.EmailChecker (in ComponentSpace.EmailChecker.dll)

See Also

MailServer Members | ComponentSpace.EmailChecker Namespace


MailServer Members

MailServer overview

Public Static (Shared) Methods

GetMailServerNames Overloaded. Gets the list of mail servers for the specified domain. The default DNS server is used to perform the MX record lookup.

Public Instance Constructors

MailServer Overloaded. Initializes a new instance of the MailServer class.

Public Instance Properties

FromEmailAddress | Gets or sets the from email address. Typically the default value is sufficient.
SmtpTranscript | Gets the transcript of SMTP commands issued to the mail server and responses from the mail server.
Timeout | Gets or sets the number of milliseconds to wait for the response from the server.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
IsValidEmailAddress | Validate the email address against the mail server.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace


MailServer Constructor

Initializes a new instance of the MailServer class with the specified server address. The address can either be the name of the server (eg. mail.componentspace.com) or its IP address (eg. 66.210.153.10).

Overload List

Initializes a new instance of the MailServer class with the specified server IP address.

public MailServer(IPAddress);

Initializes a new instance of the MailServer class with the specified server IP address.

public MailServer(IPEndPoint);

Initializes a new instance of the MailServer class with the specified server address. The address can either be the name of the server (eg. mail.componentspace.com) or its IP address (eg. 66.210.153.10).

public MailServer(string);

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace


MailServer Constructor (String)

Initializes a new instance of the MailServer class with the specified server address. The address can either be the name of the server (eg. mail.componentspace.com) or its IP address (eg. 66.210.153.10).

[Visual Basic]
Overloads Public Sub New( _
ByVal serverAddress As String _
)
[C#]
public MailServer(
string serverAddress
);

Parameters

serverAddress
The server address (eg. 66.210.153.10 or mail.componentspace.com).

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace | MailServer Constructor Overload List


MailServer Constructor (IPAddress)

Initializes a new instance of the MailServer class with the specified server IP address.

[Visual Basic]
Overloads Public Sub New( _
ByVal serverAddress As IPAddress _
)
[C#]
public MailServer(
IPAddress serverAddress
);

Parameters

serverAddress
The server IP address.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace | MailServer Constructor Overload List


MailServer Constructor (IPEndPoint)

Initializes a new instance of the MailServer class with the specified server IP address.

[Visual Basic]
Overloads Public Sub New( _
ByVal serverAddress As IPEndPoint _
)
[C#]
public MailServer(
IPEndPoint serverAddress
);

Parameters

serverAddress
The server IP address.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace | MailServer Constructor Overload List


MailServer Properties

The properties of the MailServer class are listed below. For a complete list of MailServer class members, see the MailServer Members topic.

Public Instance Properties

FromEmailAddress | Gets or sets the from email address. Typically the default value is sufficient.
SmtpTranscript | Gets the transcript of SMTP commands issued to the mail server and responses from the mail server.
Timeout | Gets or sets the number of milliseconds to wait for the response from the server.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace


MailServer.FromEmailAddress Property

Gets or sets the from email address. Typically the default value is sufficient.

[Visual Basic]
Public Property FromEmailAddress As String
[C#]
public string FromEmailAddress {get; set;}

Property Value

The from email address. The default is support@componentspace.com.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace


MailServer.SmtpTranscript Property

Gets the transcript of SMTP commands issued to the mail server and responses from the mail server.

[Visual Basic]
Public ReadOnly Property SmtpTranscript As String
[C#]
public string SmtpTranscript {get;}

Property Value

The SMTP transcript.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace


MailServer.Timeout Property

Gets or sets the number of milliseconds to wait for the response from the server.

[Visual Basic]
Public Property Timeout As Integer
[C#]
public int Timeout {get; set;}

Property Value

The number of milliseconds to wait for the response from the server. The default is 60 seconds.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace


MailServer Methods

The methods of the MailServer class are listed below. For a complete list of MailServer class members, see the MailServer Members topic.

Public Static (Shared) Methods

GetMailServerNames Overloaded. Gets the list of mail servers for the specified domain. The default DNS server is used to perform the MX record lookup.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
IsValidEmailAddress | Validate the email address against the mail server.
ToString (inherited from Object) | Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) | Creates a shallow copy of the current Object.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace


GetMailServerNames Method

ComponentSpace Email Checker Class Library Reference

MailServer.GetMailServerNames Method

Gets the list of mail servers for the specified domain. The default DNS server is used to perform the MX record lookup.

Overload List

Gets the list of mail servers for the specified domain. The default DNS server is used to perform the MX record lookup.

public static string[] GetMailServerNames(IPAddress,string,int);

Gets the list of mail servers for the specified domain. The default DNS server is used to perform the MX record lookup.

public static string[] GetMailServerNames(string,int);

Gets the list of mail servers for the specified domain. The default DNS server is used to perform the MX record lookup.

public static string[] GetMailServerNames(string,string,int);

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace


MailServer.GetMailServerNames Method (IPAddress, String, Int32)

Gets the list of mail servers for the specified domain. The default DNS server is used to perform the MX record lookup.

[Visual Basic]
Overloads Public Shared Function GetMailServerNames( _
ByVal dnsServerAddress As IPAddress, _
ByVal domainName As String, _
ByVal timeout As Integer _
) As String()
[C#]
public static string[] GetMailServerNames(
IPAddress dnsServerAddress,
string domainName,
int timeout
);

Parameters

dnsServerAddress
The DNS server IPO address.
domainName
The domain name (eg. componentspace.com).
timeout
The number of milliseconds in which to retrieve the mail server name list.

Remarks

The mail servers are returned in preference order.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace | MailServer.GetMailServerNames Overload List


MailServer.GetMailServerNames Method (String, Int32)

Gets the list of mail servers for the specified domain. The default DNS server is used to perform the MX record lookup.

[Visual Basic]
Overloads Public Shared Function GetMailServerNames( _
ByVal domainName As String, _
ByVal timeout As Integer _
) As String()
[C#]
public static string[] GetMailServerNames(
string domainName,
int timeout
);

Parameters

domainName
The domain name (eg. componentspace.com).
timeout
The number of milliseconds in which to retrieve the mail server name list.

Remarks

The mail servers are returned in preference order.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace | MailServer.GetMailServerNames Overload List


MailServer.GetMailServerNames Method (String, String, Int32)

Gets the list of mail servers for the specified domain. The default DNS server is used to perform the MX record lookup.

[Visual Basic]
Overloads Public Shared Function GetMailServerNames( _
ByVal dnsServerAddress As String, _
ByVal domainName As String, _
ByVal timeout As Integer _
) As String()
[C#]
public static string[] GetMailServerNames(
string dnsServerAddress,
string domainName,
int timeout
);

Parameters

dnsServerAddress
The DNS server address (eg. 66.210.153.10 or www.componentspace.com).
domainName
The domain name (eg. componentspace.com).
timeout
The number of milliseconds in which to retrieve the mail server name list.

Remarks

The mail servers are returned in preference order.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace | MailServer.GetMailServerNames Overload List


MailServer.IsValidEmailAddress Method

Validate the email address against the mail server.

[Visual Basic]
Public Function IsValidEmailAddress( _
ByVal emailAddress As String _
) As Boolean
[C#]
public bool IsValidEmailAddress(
string emailAddress
);

Parameters

emailAddress
The email address to check (eg. support@componentspace.com)

Return Value

True is the email address is valid; false otherwise.

Remarks

Please note that although the SMTP check can determine whether an email address is bad it cannot guarantee an address is valid as not all mail servers provide notification of invalid user names.

Exceptions

Exception Type | Condition
EmailCheckerException | Thrown when the email address validation could not complete.

See Also

MailServer Class | ComponentSpace.EmailChecker Namespace


ComponentSpace.EmailCheckerHierarchy

ComponentSpace Email Checker Class Library Reference

ComponentSpace.EmailChecker Hierarchy

System.Object
ComponentSpace.EmailChecker.EmailAddressChecker
ComponentSpace.EmailChecker.Mailbox
ComponentSpace.EmailChecker.MailServer
System.Delegate ---- System.ICloneable, System.Runtime.Serialization.ISerializable
System.MulticastDelegate
ComponentSpace.EmailChecker.CheckCompletedEventHandler
System.EventArgs
ComponentSpace.EmailChecker.CheckCompletedEventArgs
System.Exception ---- System.Runtime.Serialization.ISerializable
System.ApplicationException
ComponentSpace.EmailChecker.EmailCheckerException
System.ValueType
System.Enum ---- System.IComparable, System.IConvertible, System.IFormattable
ComponentSpace.EmailChecker.EmailCheck
ComponentSpace.EmailChecker.EmailCheckResult

See Also

ComponentSpace.EmailChecker Namespace