Validators/Email.php
Go to the documentation of this file.
1<?php
8
12class Email extends Validator
13{
21 public function validate($email, $parameters = array())
22 {
23 $valid = (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
24
25 if ($valid && $parameters['checkDns']) {
26 list($user, $domain) = explode('@', $email);
27
28 $domain = idn_to_ascii($domain, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
29
30 $valid = checkdnsrr(idn_to_ascii($domain . "."), 'MX');
31 }
32
33 return $valid;
34 }
35}
default validator for email input elements
validate($email, $parameters=array())
email validation
Validators for HTML input-elements.