[EXTENSION] E-mail sintax validator

Feel free to post your comments and bug reports here.

http://www.yiiframew…intaxvalidator/

Hi, how do you load this extension in the components ? what should be named as its array_key ?

I have implemented this extension into my user model to check for email validation, but it does not work. I supposed that it is not loaded yet, but I don't know how to load it to my config/main.php ?

Thank you.

@revo110:

you should use it in your model:

<?php


public function rules()


{


   return array(


      array('email', 'application.extensions.emailsmtpvalidator.EEmailSintaxValidator')


           )


}


?>

Quote

@revo110:

you should use it in your model:

<?php


public function rules()


{


   return array(


      array('email', 'application.extensions.emailsmtpvalidator.EEmailSintaxValidator')


           )


}


?>

I did that, but it just does not work. I don't know why.

any errors? exceptions maybe?

Hi,

That's also why I don't understand. No errors, and no exceptions were thrown, otherwise I would have copy and pasted those here.

Thanks.

Here is my code at the model:

public function rules()


    {


        return array(


            array('user_id, firstname, lastname, email', 'required'),


            array('email', 'unique'),


            array('email', 'application.extensions.emailsintaxvalidator.EEmailSintaxValidator')


        );


    }

PS:

The emailsintaxvalidator is where the name of the folder in my extensions directory. I changed it from emailsmtpvalidator. But I have tried it to change into emailsmtpvalidator, but also it didn't work.

So, any ideas yet ?

Am I the only person who uses this extension ? Does anybody experience the same thing that has happened to me ?

Thanks!

Same problem for me, o have a error:

"require …\protected\extensions\emailsintaxvalidator\EEmailSintaxValidator.php) [<a href=‘function.require’>function.require</a>]: failed to open stream: No such file or directory

before that i have other error, because the documentation say:

array(‘email’, ‘application.extensions.emailsmtpvalidator.EEmailSintaxValidator’)

and "emailsmtpvalidator" is not the correct folder name, so i have changed this part, like this:

array(‘email’, ‘application.extensions.emailsintaxvalidator.EEmailSintaxValidator’)

Any idea?

In fact the documentation had a mistake: of course, it is emailsintaxvalidator instead of emailsmtpvalidator (copy & paste is a bad idea indeed, sorry).

Ok , after this change i don’t have any error message, but hhen I input one invalid email, it does not display the error.

Model:

public function rules()

{


	return array(


		array('nome','length','max'=&gt;256),


		array('contacto','length','max'=&gt;256),


		array('email','length','max'=&gt;256),


		array('nif','length','max'=&gt;50),


		array('nome, nif', 'required'),		


		array('email', 'application.extensions.emailsintaxvalidator.EEmailSintaxValidator'),


		array('agencia_id, nif', 'numerical', 'integerOnly'=&gt;true),


	);


}

in the Form i have:

<div class="simple">

<?php echo CHtml::activeLabelEx($model,‘email’); ?>

<?php echo CHtml::activeTextField($model,‘email’,array(‘size’=>60,‘maxlength’=>256)); ?>

</div>

and i don’t have any error message…

what happens if you remove [font=“Courier New”]array(‘email’,‘length’,‘max’=>256)[/font]?

i have already try this… nothing, no message

public function rules()

{


	return array(


		array('nome','length','max'=&gt;256),


		array('contacto','length','max'=&gt;256),


		array('nif','length','max'=&gt;50),


		array('nome, nif', 'required'),		


		array('email', 'application.extensions.emailsintaxvalidator.EEmailSintaxValidator'),


		array('agencia_id, nif', 'numerical', 'integerOnly'=&gt;true),


	);


}

i put in the email input "2332"

EEmailSintaxValidator.php is in protected\extensions\emailsintaxvalidator folder

all seems to be ok in the installation and configuration fase.

Update: after long time away from Yii and MetaYii (I’m really sorry), I’m retaking the project. Fixed a really silly bug on this validator in 1.1, validator working now and available to download.