Hi there,
Is there a way i can use the checkdnsrr in php to validate the users email address in Chrono Forms? I found this code but can it be integrated with CF onsubmit.
If it's possible, where can i place this code?
Thanks.
Is there a way i can use the checkdnsrr in php to validate the users email address in Chrono Forms? I found this code but can it be integrated with CF onsubmit.
$email = '{Email}';
if(verify_email($email)){
// E-mail address looks to be in the proper format
// lets check the MX records
if(verify_email_dns($email)){
// E-mail passed both checks
echo 'Success - E-mail address appears to be valid.';
} else {
// E-mail is invalid, no MC record
echo 'Error - E-mail domain does not have an MX record.';
}
} else {
// E-mail inst formatted correctly
// so we don't even check its MX record
echo 'Error - E-mail address appears to be invalid.';
}
// Our function to filter our bogus formatted addresses
function verify_email($email){
if(!preg_match('/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,4})$/',$email)){
return false;
} else {
return $email;
}
}
// Our function to verify the MX records
function verify_email_dns($email){
// This will split the email into its front
// and back (the domain) portions
list($name, $domain) = split('@',$email);
if(!checkdnsrr($domain,'MX')){
// No MX record found
return false;
} else {
// MX record found, return email
return $email;
}
}
If it's possible, where can i place this code?
Thanks.