talira

EmailValidator

PHP email address validation against the email RFCs

open sourceMITfree

EmailValidator is a PHP library that checks email addresses against RFC 5321, 5322, 6530, 6531, 6532 and 1035. You choose one validation or combine several: RFC-style checks, a strict mode that fails on RFC warnings, a DNS check for records that show the domain accepts mail, a Message-ID check, and a spoof check for look-alike Unicode characters. You can add your own validations by implementing its interface.

Problems it solves

  • check that an email address a user typed into my PHP form is valid
  • reject email addresses whose domain can't receive mail
  • accept international email addresses with non-ASCII characters in PHP

Features

  • RFC 5321, 5322, 6530, 6531, 6532 and 1035 validation
  • strict validation that fails on RFC warnings
  • DNS check for records showing the domain accepts email
  • Message-ID validation (RFC 2822)
  • spoof check for look-alike multi-byte characters
  • combine validations with a logical AND, or add your own

Limitations

  • Needs PHP 8.1 or newer.1
  • The DNS and spoof checks need PHP's intl extension.1
  • The DNS check only shows the domain accepts mail, not that the address exists.1