1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

is there any script or tool available for verifying an email addresses

Discussion in 'Programming' started by westhaven, May 2, 2005.

  1. #1
    is there any script or tool available for verifying an email addresses
    can you guys tell me how this is done?
     
    westhaven, May 2, 2005 IP
  2. fooey

    fooey Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    no

    the only thing you can do is check that the submitted e-mail address is formatted correctly, all you can do for validation is to send an email to the address and make them click a link
     
    fooey, May 2, 2005 IP
  3. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can use either of these regular expressions to validate email addresses (you may need to throw some other characer into ranges):

    ^[-a-z0-9\.]+@(?:[-a-z0-9]+\.){1,32}[a-z]+$

    A less restrictive form:

    ^[^@]+@(?:[^\\.]+\.){1,32}[a-z]+$


    Note, though, that by the spec, parts of an email address may be quoted and may contain comments, creating email addresses that cannot be parsed with a simple regular expression like these (e.g. name(this is my address\.)@host.com is a valid email address). ISPs usually don't allow such addresses and you should be safe with the regular expressions above.

    J.D.
     
    J.D., May 2, 2005 IP
  4. chrisranjana.com

    chrisranjana.com Active Member

    Messages:
    132
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #4

    There are some scripts which query the MX record of the email domain and find whether a email is really present in the mail server :) but that is taking things a bit too far I guess !
     
    chrisranjana.com, May 5, 2005 IP
  5. markkk

    markkk Well-Known Member

    Messages:
    1,143
    Likes Received:
    49
    Best Answers:
    0
    Trophy Points:
    140
    #5
    also some scripts can detect if its free email (yahoo / hotmail etc..)
     
    markkk, May 11, 2005 IP
  6. PinoyIto

    PinoyIto Notable Member

    Messages:
    5,863
    Likes Received:
    170
    Best Answers:
    0
    Trophy Points:
    260
    #6
    here is a sample script

    if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){
    echo "<li>You enter invalid emial address";
    exit;
    } 
    Code (markup):
     
    PinoyIto, May 11, 2005 IP
  7. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Oops - a typo (in red). Should be:

    ^[^@]+@(?:[^\.]+\.){1,32}[a-z]+$

    Also, when using a regular expression to validate email addresses, make sure the expression is case-insensitive. For example:

    if(preg_match("/regex/i", $address))

    J.D.
     
    J.D., May 11, 2005 IP
  8. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #8
    palespyder, May 11, 2005 IP
  9. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #9
    A couple of notes on checking the address online.

    * Some SMTP servers are configured not to report unknown users to prevent spammers from sniffing out valid email addresses. In other words, any user within their domain will be considered as a valid user and then mail will be silently discarded for bogus users;

    * Some SMTP servers are configured to block the IP address of those clients that fail too many times (I have seen this threshold set to as low as 1 in a couple of cases), so if you fail too many times, even you mail server may be blocked if it shares the IP address with your web server;

    * Some SMTP servers will immediately disconnect unless a connection is made from the port 25 (SMTP). Your client will think that the IP address is invalid and will fail the email address for no reason;

    * Some SMTP server will immediately try to connect to the source IP address and check if there's a valid SMTP server on the other end (some are even running a spam check) and will block the source IP address if such validation fails;

    Bottom line is - think twice before implementing online email address validation.

    J.D.
     
    J.D., May 11, 2005 IP
  10. palespyder

    palespyder Psycho Ninja

    Messages:
    1,254
    Likes Received:
    98
    Best Answers:
    0
    Trophy Points:
    168
    #10
    This is absolutely correct and I should have posted the dangers associated with it, thanks J.D.
     
    palespyder, May 11, 2005 IP
  11. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #11
    What I do to verify e-mail address (when users create new accounts and things like that):

    * send out an e-mail to that address with a URL with some unique ID
    * ask users to click on that link to 'activate' their account
    * NEVER allow the change of the e-mail entry in your database -- important part :)

    It's a bit more work, but you'll end up with 100% working e-mail addresses (at least at the time they register)
     
    frankm, May 11, 2005 IP
    T0PS3O likes this.
  12. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #12
    One more thing, when validating domain names, do not limit the the last label in the address to 3 characters. Some domains may have more - .info, .name, etc:

    http://www.iana.org/gtld/gtld.htm

    J.D.
     
    J.D., May 11, 2005 IP