viil
(Viil Lid)
February 26, 2014, 9:39am
1
I use the yii email validation rule, but get "email invalid" for an email with this format:
pat.riese@mail.ccsf.edu
This is a valid email address in use. Does anyone know why the yii email validation rule calls it invalid? Doesn’t the rule allow email addresses with sub domains?
Thank you for any help solving this!
bagwari65
(Manish)
February 26, 2014, 10:11am
2
hi viil,
yes this email is not validated by yii validator, but you can try ur own validation rule for such type of mail(if it is valid) like this.............
public function rules() {
return array(
array('email', 'isValidEmailAddress'), );
}
/
public function isValidEmailAddress($attribute, $params)
{
// viil's validation rule here like below.........
//if (User::model()->find('email=:email', array(':email'=>$this->email)) !== null)
//{
// $this->addError('email', 'Email account already exists');
//}
}
I HOPE YOUR QUESTION WILL BE ANSWERABLE BY YII TEAM.
andy_s
(Arekandrei)
February 26, 2014, 10:18am
3
It is a valid email address for Yii. Maybe the problem is a trailing space?
bagwari65
(Manish)
February 26, 2014, 10:24am
4
hi andy_s I also checked this mail posted by viil…Yii is showing invalid, cud u suggest a solution plz
andy_s
(Arekandrei)
February 26, 2014, 10:52am
5
I checked it in my Yii 1.1.13 project and the email "pat.riese@mail.ccsf.edu" is considered valid by the CEmailValidator.
bagwari65
(Manish)
February 26, 2014, 11:01am
6
cud u plz suggest the rule in short in my yii 1.1.14 with ‘email’=>‘email’ it is not validating
just simple add these line -
array('email', 'email','message'=>"The email isn't correct"),
array('email', 'unique','message'=>'Email already exists!'),