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;
0 0
1 501 downloads
Yii Version: 1.1
License: (not set)
Category: Validation
Developed by: MetaYii
Created on: Nov 21, 2008
Last updated: 15 years ago


show all