Connaissez-vous un javascript qui puisse éviter de faire passer les adresses du genre : hello_AT_yahoo9.com ? ou tout autre type d'adresse mail erronée ?
Merci,
Ce message a été modifié par amateur44 - 10 juin 2008 - 10:33.
Posté 10 juin 2008 - 10:43
Posté 10 juin 2008 - 16:52
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(!customCheckDnsrr($domain)) {
return false;
}
// attempts a socket connection to mail server
if(!fsockopen($domain,25,$errno,$errstr,30)) {
return false;
}
return true;
}
return false;
}
function customCheckDnsrr($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;
}
Posté 10 juin 2008 - 17:07
Posté 10 juin 2008 - 21:07
Posté 11 juin 2008 - 09:53
Dadou, le mardi 10 juin 2008 à 21:07, dit :
Posté 11 juin 2008 - 10:16