I used this tutorial here:
Email Address Verification with PHP
here is the code I have used:
and when I use my admin email:
admin@tusc-oh.com
or my personal email:
tim-n-mary@peoplepc.com
it returns Invalid email address!
any suggestions or help would be appreciated.
Email Address Verification with PHP
here is the code I have used:
| Code: |
|
<? function CheckDnsrr($host,$recType='') { if(!empty($host)) { if($recType=='') $recType="MX"; exec("nslookup -type=$recType $host",$output); foreach($output as $line) { if(preg_match("/^$host/", $line)) { return true; } } return false; } return false; } 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; } if(!$_POST['email']) { die('Error: Email field was blank.'); }else{ $email = trim($_POST['email']); if(!checkEmail($email)) { echo 'Invalid email address!'; } else { $email1 = $_POST['email']; } } ?> |
and when I use my admin email:
admin@tusc-oh.com
or my personal email:
tim-n-mary@peoplepc.com
it returns Invalid email address!
any suggestions or help would be appreciated.
