Improved logging of email validation function
This commit is contained in:
@@ -6,18 +6,23 @@
|
||||
*/
|
||||
function _valid_email_address($email) {
|
||||
//firstly use the built-in function to validate the format
|
||||
if (! valid_email_address($email))
|
||||
if (! valid_email_address($email)) {
|
||||
watchdog('booking', "Drupal validation of email address '!email' returns false.", array('!email' => $email));
|
||||
return false;
|
||||
}
|
||||
//now check the domain exists
|
||||
|
||||
if (preg_match('/^(.*?)\@(.*)/', $email, $matches)) {
|
||||
//watchdog('booking', 'Email address checking: @info', array('@info' => var_export($matches, TRUE)));
|
||||
if (! checkdnsrr($matches[2], "MX"))
|
||||
return 0;
|
||||
return 1;
|
||||
if (! checkdnsrr($matches[2], "MX")) {
|
||||
watchdog('booking', "No valid MX record found for email address '!email' with domain name !domain", array('!email' => $email, '!domain' => $matches[2]));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
watchdog('booking', "Regular expression failed to detect domain portion of email address '!email'", array('!email' => $email));
|
||||
//watchdog('booking', 'Email address checking doesnt match');
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user