Validating an email address in php
Note that FILTER_VALIDATE_EMAIL will validate email addresses that contain domains and top-level domains that do not exist.
If you want to avoid these, you can test for top-level domains that are more than 4 characters long (which will erroneously throw out ".museum"), or for domain names that are either 2 characters long (all the country top-level domains) or one of the known top-level domains (which you will have to update as the list changes).
A very quick snippet today because I've told two people to use this approach in the last few days and both of them told me they didn't know about it.
There is no way to determine (server side) if an email user exists for an external domain.If you want to learn more about email addresses I suggest you to start reading the specs, but I have to warn you it is not an easy read by any stretch: P. A note on the regex pattern used above (from the PHP source).It looks like there is some copyright on it of Michael Rushton.The script works fine even if the user does not enter any data.The next step is to make input fields required and create error messages if needed.