By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,556 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,556 IT Pros & Developers. It's quick & easy.

Sample Code to Verify Email Addresses

P: n/a
I want to write a Windows application to go through all the email addresses
in an SQL Server table and to report which ones are invalid. From Googling
and perusing NGs it is my understanding that the process to validate an
email address is done at 3 levels:
1. Verify that it is syntactically valid
2. Verify that the domain exists (SMTP verification)
3. Verify that the email address exists at that domain (MX verification)

The first one I can do with a regular expression or some Instr functions. I
am looking for some information (ideally code samples/classes) on how to
accomplish the other two levels of verification. Any pointers are
appreciated.

Wayne
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
For number 2, it is simply a matter of doing a DNS lookup for an MX record
for the domain. Check out the System.Net.Dns class for this.

For number 3, you need to write a small app to converse with the SMTP server
determined by number 2. If I remember rightly it us the VERIFY command that
you need to use. You will need to read up on the RFC for the SMTP protocol,
copies of which are readily available on the internet.

Once you have 2 and 3 sussed out then number 1 is redundant.
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:OA**************@TK2MSFTNGP14.phx.gbl...
I want to write a Windows application to go through all the email addresses
in an SQL Server table and to report which ones are invalid. From Googling
and perusing NGs it is my understanding that the process to validate an
email address is done at 3 levels:
1. Verify that it is syntactically valid
2. Verify that the domain exists (SMTP verification)
3. Verify that the email address exists at that domain (MX verification)

The first one I can do with a regular expression or some Instr functions.
I
am looking for some information (ideally code samples/classes) on how to
accomplish the other two levels of verification. Any pointers are
appreciated.

Wayne

Nov 21 '05 #2

P: n/a
Thanks for that information. I'll go do a bit of reading.

Wayne

"Stephany Young" <noone@localhost> wrote in message
news:um**************@TK2MSFTNGP10.phx.gbl...
For number 2, it is simply a matter of doing a DNS lookup for an MX record
for the domain. Check out the System.Net.Dns class for this.

For number 3, you need to write a small app to converse with the SMTP
server determined by number 2. If I remember rightly it us the VERIFY
command that you need to use. You will need to read up on the RFC for the
SMTP protocol, copies of which are readily available on the internet.

Once you have 2 and 3 sussed out then number 1 is redundant.
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:OA**************@TK2MSFTNGP14.phx.gbl...
I want to write a Windows application to go through all the email
addresses
in an SQL Server table and to report which ones are invalid. From
Googling
and perusing NGs it is my understanding that the process to validate an
email address is done at 3 levels:
1. Verify that it is syntactically valid
2. Verify that the domain exists (SMTP verification)
3. Verify that the email address exists at that domain (MX verification)

The first one I can do with a regular expression or some Instr functions.
I
am looking for some information (ideally code samples/classes) on how to
accomplish the other two levels of verification. Any pointers are
appreciated.

Wayne


Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.