Close

April 28, 2015

How to Validate an Email Address (By Domain) Using PHP

How can I validate an email address (by domain) using PHP? Here’s how:

Here’s the class that does all the heavy lifting and an example page for including and using the class:

These are the exact steps for using this:

  1. Include/require class-validate-email.php into your application or web page.
  2. Instantiate a new instance of the validate_email class.
  3. Pass the email address to the validate_email::validate_by_domain() method.

If you get value from this code snippet, please consider sharing it with another developer or group who could benefit from it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.