[email protected] - Discussion - Phalcon Framework"> [email protected] - Discussion - Phalcon Framework"> [bug] Phalcon\Mvc\Model\Validator\Email not work: check like this emall: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="59303229312919383b3a3d3c">[email protected]</a> - Discussion - Phalcon Framework
We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[bug] Phalcon\Mvc\Model\Validator\Email not work: check like this emall: [email protected]

Phalcon\Mvc\Model\Validator\Email, this Validator does not work, check it with an email like: [email protected]

When I use a string like this "[email protected]"

/**
 * 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>
 *
 */


13.1k
edited Jul '14

you can try it Validator Email string like this $email = '[email protected]'; that Validator will return true



98.9k
Accepted
answer

Actually, [email protected] is a valid email, a domain does not necessarily have to contain dots to be valid. Check the RFC for more information https://tools.ietf.org/html/rfc2822

For instance, an email like [email protected] is completely valid.