emailvalidator Email validator

EEmailValidator is a validator class which relies on Manuel Lemos' e-mail address validation class (see that class for further dependencies)

This validator performs basic regex validation and some advanced checks using getmxrr to verify the validity of a given e-mail address.

Manuel Lemos' class uses an alternate GetMXRR function from the DNSResolver code by Moriyoshi Koizumi, in case the getmxrr function is not available or is not working. His code is not OOP, so I tried to make PHP5 classes with it, but it's not fully tested, so, if you don't have a working getmxrr or are under windows, either use it under your own risk or send me patches ;)

Please read the source code for the meaning of the various properties.

Resources

Documentation

Requirements
  • Yii 1.0 or above
Installation
  • Extract the release file under protected/extensions
Usage

In the view:

<?php echo CHtml::activeLabel($user, 'email'); ?>
<?php echo CHtml::activeTextField($user, 'email', 
        array('title'=>Yii::t('demo', 'Enter your e-mail'))); ?>
<?php echo CHtml::error($user, 'email'); ?>

In the model:

<?php
class UserModel extends CFormModel
{
   public $email;

   public function rules()
   {
      return array(
         array('email', 
               'application.extensions.emailvalidator.EEmailValidator',  
               'strictValidation'=>false),
      );
   }

   public function attributeLabels()
   {
      return array(
         'email'=>Yii::t('demo', 'Enter your e-mail address: '),
      );
   }
}
3 0
4 followers
1 728 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Validation
Tags:
Developed by: MetaYii
Created on: Nov 19, 2008
Last updated: 9 years ago

Downloads

show all