1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| function validateEmail ($email) {
// Les addresse du style "Benjamin Delespierre <benjamin.delespierre@xyz.com>" sont valides dans les emails
$email = str_replace(array('<', '>'), '', $email);
if ($offset = strrpos($email, ' ') !== false)
return self::validateEmail(substr($email, $offset));
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
return false;
if (function_exists('checkdnsrr')) {
$host = substr($email, strpos($email, '@') + 1);
return checkdnsrr($host, 'MX');
}
return true;
} |
Partager