[OT] Validating Email Addresses...

Martin Baxter mb.userev at harbourhosting.co.uk
Tue Jan 29 18:06:12 EST 2008


Jim Carwardine wrote:
> Hi Folks... I offer some free downloads on my web site...
> 
> (a web site I will be recreating using Rev - so I feel some legitimacy
> asking the question on this list - as I will need to do something in Rev
> ultimately)
> 
> ... And I'm asking for some contact information from the downloader (fair
> trade I feel).  I'm getting a lot of garbage being offered by people who
> want a look but don't want to give their info.
> 
> Screening for legitimate email addresses is done on many web sites and I
> understand:
> 
> 1. Checking for the @ sign - a very weak edit.
> 2. Sending the download link by email to the downloader's email address -
> pretty strong edit.
> 
> What I see some web sites do is legitimize the email address on the spot and
> immediately deny access if the email is illegitimate.  How is this done?
> 
> Any other great ideas about screening email addresses?
> 
> Thanks... Jim
> 

Hi Jim,

Apart from testing for well-formed-ness using regex, since I am a php
type I sometimes also use the php function checkdnsrr, (which, last time
I checked, cannot be used on windows but works on unix servers).

syntax
checkdnsrr(host,record type)

I use it in a function like like this:

if(checkdnsrr(array_pop(explode("@",$email)),"MX")){
	return true; # or whatever
}else{
	return false; # or whatever
}

$email holds the email address of course.

This doesn't prove that the particular mail recipient is valid, but does
test that the domain exists and has an MX record. (Array_pop and explode
are just cute ways of extracting the domain part from the email address.)

AFAIK the only way to know for sure that the recipient is genuine is to
send a message.

FWIW

Martin Baxter





More information about the use-livecode mailing list