1

Some times Yii Email validation show error message when we use domain name based email or company email address. how to fix it in yii framework?

saravankg
  • 909
  • 1
  • 10
  • 21
  • 1
    That's strange. What, exactly, is the message you're getting, and what's an example of an email address that's having trouble? (Please don't post someone's actual email address). – ethan Dec 19 '13 at 18:58
  • It would also be interesting to see the rule firing off `CEmailValidator`. Could you possibly update your question to contain the relevant line out of your model's `rules()` method? – DaSourcerer Dec 19 '13 at 23:22

1 Answers1

0

You can try to use your own custom validation rule for e-mail addresses using regular expression.

ezze
  • 3,933
  • 2
  • 34
  • 58
  • array('email', 'match', 'pattern'=>'/^[\w\s,]+$/', 'message'=>'only contain word characters.') - like this? – saravankg Dec 19 '13 at 19:11
  • A regular expression proposed doesn't look like the one to validate e-mail - it doesn't contain `@` character, at least. [Yii validates e-mails](https://github.com/yiisoft/yii/blob/1.1.14/framework/validators/CEmailValidator.php#L24) according to [RFC 5322](http://tools.ietf.org/html/rfc5322#section-3.4). If you are not satisfied by this implementation and can't compose convenient validation pattern by yourself you could look for simplified regular expression that fits your needs, i.e. [here](http://www.regular-expressions.info/email.html) (see `Trade-Offs in Validating Email Addresses`). – ezze Dec 19 '13 at 20:10