<?php
class EmailValidator {
	private $model;

	public function __construct ($model) {
		$this->model = $model;
	}

	public function validate ($property, $rules) {
		if (!empty($this->model->$property)) {
			if (preg_match('/^\A[^\s@]+@[^\s.@][^\s@]*\.[^\s@]+$/ui', $this->model->$property) != 1) {
				return array('email' => $rules['name']);
			}
		}

		return ValidationHelper::validateLength(mb_strlen($this->model->$property), $rules);
	}
}
?>

<?php
class EmailValidator {
	private $model;

	public function __construct ($model) {
		$this->model = $model;
	}

	public function validate ($property, $rules) {
		if (!empty($this->model->$property)) {
			if (preg_match('/^\A[^\s"(),:;<>\[\]\\\@]+@[^\s.@][^\s@]*\.[^\s@]+$/ui', $this->model->$property) != 1) {
				return array('email' => $rules['name']);
			}
		}

		return ValidationHelper::validateLength(mb_strlen($this->model->$property), $rules);
	}
}
?>

Make email validation a bit stricter again
Make email validation a bit stricter again

This expands the email validation somewhat, adding characters that can
only be used within a quoted part of an email address to the illegal
characters in the local part of the address. These are characters like
backslash, square brackets, parenthesis etc. which in general nobody use
or should use.
