The Quick Guide to Validating Email Addresses in PHP

Protect the integrity of your email lists by using PHP to check the validity of an email address in a signup form.

Use HTML Validation

If you have the option, err on the side of using HTML to validate email addresses directly in the web form. Build email validation into the HTML to keep your site and the filters that support it in the same code base.

If you can’t use HTML validation, use PHP validation.

PHP Validation

You can also use the PHP email validation filter FILTER_VALIDATE_EMAIL to remove email addresses that contain domains and top-level domains that don’t exist. Alternatively, you can try top level domains longer than 4 characters (which will erroneously remove “.museum”), or 2 character domain names (all country top level domains) or one of the top level domains known (which you will need to update as the list changes).

FILTER_VALIDATE_EMAIL will erroneously reject email addresses with long domain names – 64 characters or more – and email addresses with escaped characters (such as “me”@example.com””). To avoid these false positives

TechnoAdmin