Sample Code to Verify Email Addresses

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wayne  Wengert

    #1

    Sample Code to Verify Email Addresses

    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


  • Stephany Young

    #2
    Re: Sample Code to Verify Email Addresses

    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" <wayneDONTWANTS PAM@wengert.com > wrote in message
    news:OAMvuWmUFH A.1944@TK2MSFTN GP14.phx.gbl...[color=blue]
    >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
    >
    >[/color]


    Comment

    • Wayne Wengert

      #3
      Re: Sample Code to Verify Email Addresses

      Thanks for that information. I'll go do a bit of reading.

      Wayne

      "Stephany Young" <noone@localhos t> wrote in message
      news:umxlc5oUFH A.3344@TK2MSFTN GP10.phx.gbl...[color=blue]
      > 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" <wayneDONTWANTS PAM@wengert.com > wrote in message
      > news:OAMvuWmUFH A.1944@TK2MSFTN GP14.phx.gbl...[color=green]
      >>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
      >>
      >>[/color]
      >
      >[/color]


      Comment

      Working...