Php function for validating email addresses

An updated version incorporating many of the comments below has been released under an open source license as a Google Code project: php-email-address-validation.

There is more about this change in the post Email Address Validation Updated.

Older email addresses may be made up differently, and may contain a combination of the above.

The following are all valid as the first part of an email address: The "domain" portion of the email address can also be made up in different ways.

The "local-part" of an email address must be between 1 and 64 characters in length and may be made up in any one of three ways.

It can be made up of a selection of characters (and only these characters) from the following selection (though the period can not be the first of these): Or, it can be made up of a quoted string containing any characters except "\".

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

bathroom-blowjob

bathroom-blowjob

Many, for example, assume that an email address with a domain name extension of more than three letters is invalid.A domain name, technically, need be only one label.However, new TLDs such as ".info", ".name" and ".aero" are perfectly valid but longer than three characters.Many email address validators fail to take into account that you do not necessarily need a domain name in an email address - an IP address is fine.

The most common form is a domain name, which is made up of a number of "labels", each separated by a period and between 1 and 63 characters in length.

Labels may contain letters, digits and hyphens, however must not begin or end with a hyphen (officially, a label must begin with a letter, not a digit, however many domain names have been registered beginning with digits so for the purposes of validation we will assume that digits are allowed at the start of domain names).

english-premier-league.ru

80 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>