validate email without a model

Hello.

What would be the best way to run Yii email validator outside of the model?

Ex.: user submits a list of emails (separated by commas), I explode them into array and need to run email validation for each item.

Should I create a dummy model or is there any better solution?

Thank you.

(not tested).




$validator = new CEmailValidator;

if($validator->validateValue("test@domain.tld"))

{

    // valid

}else{

    // invalid

}



CEmailValidator does not have a method named "validateValue".

I just tested for myself and it works




		$validator = new CEmailValidator;

		if($validator->validateValue("test@gmail.com"))

			echo "validated";



Try validateAttribute() method.

Validate attribute works with models and does not return a boolean value.

read the source http://code.google.com/p/yii/source/browse/trunk/framework/validators/CEmailValidator.php

CEmailValidator::validateValue($value) is the method to use.

validateValue() is available in SVN but not in a official relase so far, isnt it?

I usually use validateValue() wich does what needs to be done