The following article will describe how to use aspNetMX from Visual Studio .NET
using C#. This brief tutorial assumes you have IIS installed locally on your
machine, and have downloaded and installed aspNetMX from www.aspNetMX.com.

Instructions
Using Visual Studio .NET (VS.NET ) You will create a single webform
(subscribe.aspx) that allows users to subscribe to a website newsletter list.
Subscribe.aspx will use aspNetMX to validate the email addresses before the
addresses are entered into the database. The following exmaple uses C#.
However, the VB.NET example can be found at the link above.

Note:
Because complete mailbox validation is a time-intensive process, and if a valid
email address's mail server might be down (resulting in a valid email address
being rejected), it's recommended that the validation level for aspNetMX NEVER
exceed MXValidateLevel.MXRecords when used in a website or from ASP.NET. This
guarantees a reasonable level of validation, without irritating the user with
unnecessary time delays. Please note that if your DNS server is down, or a
connection to your DNS server fails, valid email addresses may be considered
invalid.

2. The Add Existing Item dialog box appears.
Under Files of Type, select All Files(*.*).
Navigate to the aspNetMX install directory. Double-click the aspNetMX.dll.
The Add Existing Item dialog box closes, and the aspNetMX.dll
was imported to the root directory of your project.

This code first checks to see if the page was posted. If
the page was posted, the email address is attempted to be validated at the
MXRecord level. If the validation succeeds, MXValidateLevel.MXRecords is
returned. If validation would have failed, a lesser level, say
MXValidateLevel.NotValid or MXValidateLevel.Syntax would have been
returned. If an exception occurs, it is probably due to not being able to
connect to the DNS Server. Record the email address anyway, so a
potential subscriber is not lost.

SaveEmailAddresses( string EmailAddress ) is a place
holder function that accepts a valid email address and would save it to your
data store.

Testing The Page
Lets compile and test the page.

1. In the Solution Explorer, right-click subscribe.aspx
and select View in Browser.

2. Enter an email address to check for validation, and click Submit
.

Summary
That's all there is to using aspNetMX from Visual Studio .NET. In these few
simple steps you were able to create a project, set a reference to aspNetMX,
and validate an address. For more questions or comments, feel free to write
support@aspNetMX.com

Complete Source Code Listing
The entire source listing can be found here.