Validation on email address

Discussion in 'ASP General' started by David, the great, Jun 17, 2008.

  1. Hi,
    Is there a way to validate an email address and to check whether it is
    sendable?


    Function EmailTo(ToEmail, FromEmail, strSubject, strBody)

    Set objMessage = CreateObject("CDO.Message")
    objMessage.Subject = strSubject
    objMessage.From = FromEmail
    objMessage.To = ToEmail
    objMessage.HTMLBody = strBody



    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2


    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MAILSERVER

    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    objMessage.Configuration.Fields.Update


    If objMessage.Send Then
    EmailTo = 1
    Else
    EmailTo = 0
    End If

    Set objMessage = nothing
    End Function



    The code shown as above, even if the mail is not successfully send, it still
    return the value 1.
     
    David, the great, Jun 17, 2008
    #1
    1. Advertising

  2. David, the great

    Evertjan. Guest

    =?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
    microsoft.public.inetserver.asp.general:

    > Is there a way to validate an email address


    While you can check if the address has a @ in it and some letters before
    the @ and letters period letters after the @, you will experience that any
    more elaborate scheme will usually get some of your correspondents into
    unforeseen trouble.

    > and to check whether it is sendable?


    The proof of the pudding is in the eating,
    trial and error sending is the only real valid option,
    I think.

    [Some?] serverside email programmes,
    I happily use Jmail and have no experience with others,
    return a boolean false if the sending aborts.

    Final testing without sending if the email adress string is valid,
    seems impossible.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jun 17, 2008
    #2
    1. Advertising

  3. "Evertjan." <> wrote in message
    news:Xns9AC06CC091EB4eejj99@194.109.133.242...
    > =?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
    > microsoft.public.inetserver.asp.general:
    >
    >> Is there a way to validate an email address

    >
    > While you can check if the address has a @ in it and some letters before
    > the @ and letters period letters after the @, you will experience that any
    > more elaborate scheme will usually get some of your correspondents into
    > unforeseen trouble.
    >
    >> and to check whether it is sendable?

    >
    > The proof of the pudding is in the eating,
    > trial and error sending is the only real valid option,
    > I think.
    >
    > [Some?] serverside email programmes,
    > I happily use Jmail and have no experience with others,
    > return a boolean false if the sending aborts.
    >
    > Final testing without sending if the email adress string is valid,
    > seems impossible.


    There are 3rd party components that will validate email addresses, but I
    can't vouch for how good any of them are. A trial version of an Hexillion
    component helped me clean a list up once, but wasn't foolproof.

    --
    Mike Brind
    Microsoft MVP - ASP/ASP.NET
     
    Mike Brind [MVP], Jun 17, 2008
    #3
  4. Mike wrote on Tue, 17 Jun 2008 10:47:21 +0100:


    > "Evertjan." <> wrote in message news:Xns9AC06CC091EB4eejj99@194.109.133.242...
    >> =?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
    >> microsoft.public.inetserver.asp.general:


    >>> Is there a way to validate an email address


    >> While you can check if the address has a @ in it and some letters
    >> before the @ and letters period letters after the @, you will
    >> experience that any more elaborate scheme will usually get some of
    >> your correspondents into unforeseen trouble.


    >>> and to check whether it is sendable?


    >> The proof of the pudding is in the eating, trial and error sending is
    >> the only real valid option,
    >> I think.


    >> [Some?] serverside email programmes,
    >> I happily use Jmail and have no experience with others, return a
    >> boolean false if the sending aborts.


    >> Final testing without sending if the email adress string is valid,
    >> seems impossible.


    > There are 3rd party components that will validate email addresses, but
    > I can't vouch for how good any of them are. A trial version of an
    > Hexillion component helped me clean a list up once, but wasn't
    > foolproof.


    If it relies on using the VRFY command in SMTP, or goes through the motions
    of sending but sending a QUIT after the SMTP response that says the RCPT TO
    clause it accetped, then it'll only work in specific circumstances. VRFY is
    often disabled as it's an open invitation for spammers to just repeatedly
    try random strings until they find valid addresses, and the other method
    only works if you happen to be sending direct to the receipient SMTP server
    and it is able to verify that the account exists and doesn't have a blanket
    setting to just accept all email and discard those that are for non-existent
    accounts. Often the web server is unable to contact the end recipient server
    directly and so these methods will fail before even getting to the first
    stage.

    --
    Dan
     
    Daniel Crichton, Jun 17, 2008
    #4
  5. "Daniel Crichton" <> wrote in message
    news:...
    > Mike wrote on Tue, 17 Jun 2008 10:47:21 +0100:
    >
    >
    >> "Evertjan." <> wrote in message
    >> news:Xns9AC06CC091EB4eejj99@194.109.133.242...
    > >> =?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
    > >> microsoft.public.inetserver.asp.general:

    >
    > >>> Is there a way to validate an email address

    >
    > >> While you can check if the address has a @ in it and some letters
    > >> before the @ and letters period letters after the @, you will
    > >> experience that any more elaborate scheme will usually get some of
    > >> your correspondents into unforeseen trouble.

    >
    > >>> and to check whether it is sendable?

    >
    > >> The proof of the pudding is in the eating, trial and error sending is
    > >> the only real valid option,
    > >> I think.

    >
    > >> [Some?] serverside email programmes,
    > >> I happily use Jmail and have no experience with others, return a
    > >> boolean false if the sending aborts.

    >
    > >> Final testing without sending if the email adress string is valid,
    > >> seems impossible.

    >
    >> There are 3rd party components that will validate email addresses, but
    >> I can't vouch for how good any of them are. A trial version of an
    >> Hexillion component helped me clean a list up once, but wasn't
    >> foolproof.

    >
    > If it relies on using the VRFY command in SMTP, or goes through the
    > motions of sending but sending a QUIT after the SMTP response that says
    > the RCPT TO clause it accetped, then it'll only work in specific
    > circumstances. VRFY is often disabled as it's an open invitation for
    > spammers to just repeatedly try random strings until they find valid
    > addresses, and the other method only works if you happen to be sending
    > direct to the receipient SMTP server and it is able to verify that the
    > account exists and doesn't have a blanket setting to just accept all email
    > and discard those that are for non-existent accounts. Often the web server
    > is unable to contact the end recipient server directly and so these
    > methods will fail before even getting to the first stage.


    Which all goes to support Evertjan's reply - send the email. Get them to
    click a link in it that validates the fact that they received it. We
    shouldn't really be sending email to people unless they have asked for it in
    the first place...

    --
    Mike Brind
    Microsoft MVP - ASP/ASP.NET
     
    Mike Brind [MVP], Jun 17, 2008
    #5
  6. David, the great

    Tim Slattery Guest

    David, the great <David, the > wrote:

    >Hi,
    >Is there a way to validate an email address and to check whether it is
    >sendable?


    Not really. You can check for proper syntax, but remember that there
    are a variety of acceptable syntaxes for email addresses. Once you're
    sure the syntax is right, does the domain name actually have a mail
    server? And if there's a server, is the user name (left of the @ sign)
    a legitimate user on that server? The only way to be 100% sure is to
    send it. Of course, if the user is bogus the mail server may just
    swallow the message and send no bounce message. Then you're no wiser
    than you were before.

    --
    Tim Slattery
    MS MVP(Shell/User)

    http://members.cox.net/slatteryt
     
    Tim Slattery, Jun 17, 2008
    #6
  7. Mike wrote on Tue, 17 Jun 2008 13:07:35 +0100:


    > "Daniel Crichton" <> wrote in message news:...
    >> Mike wrote on Tue, 17 Jun 2008 10:47:21 +0100:



    >>> "Evertjan." <> wrote in message
    >>> news:Xns9AC06CC091EB4eejj99@194.109.133.242...
    >>>> =?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= wrote on 17 jun 2008 in
    >>>> microsoft.public.inetserver.asp.general:


    >>>>> Is there a way to validate an email address


    >>>> While you can check if the address has a @ in it and some letters
    >>>> before the @ and letters period letters after the @, you will
    >>>> experience that any more elaborate scheme will usually get some of
    >>>> your correspondents into unforeseen trouble.


    >>>>> and to check whether it is sendable?


    >>>> The proof of the pudding is in the eating, trial and error sending
    >>>> is the only real valid option,
    >>>> I think.


    >>>> [Some?] serverside email programmes,
    >>>> I happily use Jmail and have no experience with others, return a
    >>>> boolean false if the sending aborts.


    >>>> Final testing without sending if the email adress string is valid,
    >>>> seems impossible.


    >>> There are 3rd party components that will validate email addresses,
    >>> but
    >>> I can't vouch for how good any of them are. A trial version of an
    >>> Hexillion component helped me clean a list up once, but wasn't
    >>> foolproof.


    >> If it relies on using the VRFY command in SMTP, or goes through the
    >> motions of sending but sending a QUIT after the SMTP response that
    >> says the RCPT TO clause it accetped, then it'll only work in
    >> specific circumstances. VRFY is often disabled as it's an open
    >> invitation for spammers to just repeatedly try random strings until
    >> they find valid addresses, and the other method only works if you
    >> happen to be sending direct to the receipient SMTP server and it is
    >> able to verify that the account exists and doesn't have a blanket
    >> setting to just accept all email and discard those that are for
    >> non-existent accounts. Often the web server is unable to contact the
    >> end recipient server directly and so these methods will fail before
    >> even getting to the first stage.


    > Which all goes to support Evertjan's reply - send the email. Get them
    > to click a link in it that validates the fact that they received it. We
    > shouldn't really be sending email to people unless they have asked
    > for it in the first place...


    I can't agree more with that reply :)

    --
    Dan
     
    Daniel Crichton, Jun 18, 2008
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark B
    Replies:
    3
    Views:
    2,137
    Mark B
    Jul 22, 2009
  2. Zeynel
    Replies:
    1
    Views:
    573
    alex23
    Dec 6, 2010
  3. Vamsi Krishna

    regarding validation of email address.

    Vamsi Krishna, Jul 28, 2008, in forum: Ruby
    Replies:
    2
    Views:
    121
    Kyle Schmitt
    Jul 28, 2008
  4. Bob

    Email Address Validation

    Bob, Jun 21, 2005, in forum: Perl Misc
    Replies:
    10
    Views:
    330
  5. Replies:
    5
    Views:
    266
    Dr John Stockton
    Dec 23, 2005
Loading...

Share This Page