Yii 1.1: emailsmtpvalidator

E-mail address validation using SMTP only

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."




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


  • Extract the release file under protected/extensions


In the model:

public $email;
public function rules()
      return array(


 * 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

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

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,489 times
  • Created on: Nov 21, 2008
  • Last updated: Feb 4, 2009