Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

[bug] Phalcon\Mvc\Model\Validator\Email not work: check like this emall: ikphp@abcde

Phalcon\Mvc\Model\Validator\Email, this Validator does not work, check it with an email like: ikphp@abcde

When I use a string like this "ikphp@ddd"

/**
 * Phalcon\Mvc\Model\Validator\Email
 *
 * Allows to validate if email fields has correct values
 *
 *<code>
 *  use Phalcon\Mvc\Model\Validator\Email as EmailValidator;
 *
 *  class Subscriptors extends Phalcon\Mvc\Model
 *  {
 *
 *      public function validation()
 *      {
 *          $this->validate(new EmailValidator(array(
 *              'field' => 'electronic_mail'
 *          )));
 *          if ($this->validationHasFailed() == true) {
 *              return false;
 *          }
 *      }
 *
 *  }
 *</code>
 *
 */


5.4k
edited Jul '14

you can try it Validator Email string like this $email = 'ikphp@dddd'; that Validator will return true



81.1k
Accepted
answer

Actually, ikphp@dddd is a valid email, a domain does not necessarily have to contain dots to be valid. Check the RFC for more information http://tools.ietf.org/html/rfc2822

For instance, an email like root@localhost is completely valid.