Yii 1.1: emailsmtpvalidator

E-mail address validation using SMTP only
2 followers

EEmailSmtpValidator validates that the attribute value is a valid e-mail address, using SMTP.

It is heavily based on SMTP_validateEmail and uses Net/DNS on plattforms without getmxrr.

This validator should be considered as an improvement of EEmailValidator.

Citing the author of the SMTP email validation class: "this class is meant to be a secondary validation of an email address after the email syntax is validated. It can also provide intermediate email validation before sending a confirmation email to the email address, which does not provide user feedback if the email is invalid - and thus loss of users."

Resources

Documentation

Requirements

  • Yii 1.0 or above
  • Net/DNS (bundled)

Installation

  • Extract the release file under protected/extensions

Usage

In the model:

public $email;
public function rules()
   {
      return array(
         array('email',
                'application.extensions.emailsmtpvalidator.EEmailSmtpValidator',
                'strictValidation'=>true, 
                'nameServers'=>array('192.168.0.1')))
   }

Properties

/**
 * SMTP Port
 */
private $port = 25;
/**
 * Nameservers to use when make DNS query for MX entries
 * @var Array $nameservers
 */
private $nameServers = array('localhost');
/**
 * How many seconds to wait before each attempt to connect to the
 * destination e-mail server
 *
 * @var integer
 */
private $timeOut = 10;
/**
 * How many seconds to wait for data exchanged with the server.
 * Set to a non zero value if the data timeout will be different
 * than the connection timeout.
 *
 * @var integer
 */
private $dataTimeOut = 5;
/**
 * The address of the sending user
 *
 * @var string
 */
private $sender = 'postmaster@localhost';
/**
 * If it is not possible to verify if the e-mail address is id,
 * and this flag is set to true, then the validation will fail.
 *
 * @var boolean
 */
private $strictValidation = false;

Total 1 comment

#11916 report it
kfahmi at 2013/02/12 11:37pm
help

did anyone using this ext? teach me please.. i dont understand 'nameServers'=>array('192.168.0.1')))

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: Other Open Source License
  • Developed by: MetaYii
  • Category: Validation
  • Votes: No votes yet
  • Downloaded: 1,134 times
  • Created on: Nov 21, 2008
  • Last updated: Feb 4, 2009