Hello,
I am using the following function in order to validate an e-mail address field in my form:
function checkEmail($email) {
// checks proper syntax
if(preg_match("/( [a-zA-Z0-9] )+( [a-zA-Z0-9.-] )*@( [a-zA-Z0-9-] )+( [a-zA-Z0-9._-] +)+$/",$email)) {
// gets domain name
list($username,$domain)=split('@',$email);
// checks for if MX records in the DNS
if(!checkdnsrr($domain, 'MX')) {
return false;
}
// attempts a socket connection to mail server
if(!fsockopen($domain,25,$errno,$errstr,30)) {
return false;
}
return true;
}
return false;
}
The function returns false even to a good email address. I was thinking maybe there is an error in the script...
Help anyone? 😕