Code for validating email address

You can now validate email addresses entered into your site against the specifications that define email addresses (more or less - domain names that start with a number are supposed to be invalid, but do exist).

Finally, please do remember that because an email valid does not mean it is in use.

The first step to creating a PHP script for validating email addresses is to work out what is and is not valid.

RFC 2822, that specifies what is and is not allowed in an email address, states that the form of an email address must be of the form "local-part @ domain".

Next, we need to check the domain portion of the email address.