View Full Version : Checking for real email address input.

10-21-2009, 12:33 PM

I have the following regex to check if the email is entered correctly
but I think that it should be checking that it ends in .com or .org or .net
or .co.uk or at least .xx ?

From what I can work out this isn't checking that ?

// Test for valid email address.
if ( !ereg( "^.+@.+\\..+$",$N_email) ){
$message1 = "Please enter your correct email address.";
require_once ("index1_fm.php");
} // endif

Would appreciate some help in tightening up this input check.

10-21-2009, 12:42 PM
Have you googled for php+form+validation ?

10-21-2009, 02:49 PM

I now have this one:

eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)

Would you say it is a better one ?

On the same subject, once I am happy that it is a valid
format, is there a way to find out if it is an existing email account
rather than a made-up one ?

( I mean without using the confirmation link method )


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum