Page 1 of 1

Verifying Emails - the reliable way

Posted: Mon Jan 26, 2004 4:38 am
by patrikG
If you need to be absolutely sure that an email is correct and working - I've just come across this script:

http://www.weberdev.com/get_example.php3/1238

It does the following:

/* This function takes in an email address (say 'shane@tuna.org')
* and tests to see if it's a valid email address.
*
* An array with the results is passed back to the caller.
*
* Possible result codes for the array items are:
*
* Item 0: [true|false] true for valid email address
* false for NON-valid email address
*
* Item 1: [SMTP Code] if a valid MX mail server found, then
* fill this array in with failed SMTP
* reply codes
*
* Item 2: [true|false] true for valid mail server found for
* host/domain
* false if no valid mail server found
*
* Item 3: [MX server] if a valid MX host was found and
* connected to then fill in this item
* with the MX server hostname
*
* EXAMPLE code for use is at the very end of this function.
*/

Neat.

Posted: Mon Jan 26, 2004 9:48 am
by m3mn0n
I used one of those, and I did enjoy the results.

There was a significantly reduced ammount of fake emails being registered on a client's site.

I highly recommend such a system.

Posted: Tue Jan 27, 2004 6:11 am
by markbeadle
Need to be careful.

I could not get all addresses recognised (e.g. xyz@yahoo.com).

Regards

Posted: Wed Jan 28, 2004 1:26 pm
by Weirdan
Perhaps the best verification is the user writing from that address ;)

Posted: Wed Jan 28, 2004 5:11 pm
by m3rajk
Weirdan wrote:Perhaps the best verification is the user writing from that address ;)
that's why i'm not gong to run out and get that. i have one that checks all top levels (thank you genik for a link that has all the 3+ letter top levels) and uses \w\w to check two letter country codes for the final bit, and then checks format for the rest (i'll drop in the preg call if anyone wants) and then the user has to return to the site via a link to sign up. thus validating the email.

Posted: Wed Jan 28, 2004 8:29 pm
by timvw
Here's the regex writting in perl (conform with rfc822) http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html