Jump to content

email detection


M.O.S. Studios

Recommended Posts

working on a function that makes sure an entered email is valid.

 

I'm having some problems, i think it might be with the preg_match() or with the regex,

 

if i take  that out of the function it runs fine but doesn't detect  format.

 

 

function email_vari($email){
list($username,$domain)=split('@',$email);
if((!preg_match("/(^[a-z.-_0-9]*)/i", $username)) && (!preg_match("/(^[a-z0-9]*)/i", $domain))){
	list($username,$domain)=split('@',$email);
	if(!getmxrr ($domain,$mxhosts)){
		$return = FALSE;
	}else{
		$return = TRUE;
	}
}else{
	$return = FALSE;
}
if($return === FALSE){return VALIDEMAIL;}
}

 

 

any ideas thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/207658-email-detection/
Share on other sites

because its about time we replace the wheel with hover jets.

 

function email_vari($email){
if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email)){
	$return = FALSE;
}else{
	list($Username, $Domain) = split("@",$email);

	if(@getmxrr($Domain, $MXHost)){
		$return = TRUE;
	}else{
		if(@fsockopen($Domain, 25, $errno, $errstr, 30)){
			$return = TRUE;
		}else{
			$return = FALSE;
		}
	}
}
if($return === FALSE){return VALIDEMAIL;}
}

Link to comment
https://forums.phpfreaks.com/topic/207658-email-detection/#findComment-1086491
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.