Email Addresses
Ever go to a web site to enter your email address and find that it wouldn’t fit in the field they provided?
It’s amazing in a world of standards that companies (and individuals) continually ignore them and decide for themselves what’s acceptable.
HELLO!
User names (or local part of the address) can be 64 characters long, and domain names can be 255 characters long.
Here is an example of a reasonable well written validation for email addresses — if you want to see poorly done ones in action it doesn’t take too much effort to find ones that limit the entire email address to less than 30 characters!
<?php function isValidAddress( $email, $check = false )
{
##############################
# PHP Email Address Validator
# (C) Derrick Pallas
#
# Authors: Derrick Pallas
# Website: http://derrick.pallas.us/email-validator/
# License: Academic Free License 2.1
# Version: 2006-12-01a
if (!ereg(”
. ‘^’
. ‘[-!#$%&\'*+/0-9=?A-Z^_a-z{|}~]‘
. ‘(\\.?[-!#$%&\'*+/0-9=?A-Z^_a-z{|}~])*’
. ‘@’
. ‘[a-zA-Z](-?[a-zA-Z0-9])*’
. ‘(\\.[a-zA-Z](-?[a-zA-Z0-9])*)+’
. ‘$’
) ) return false;
list( $local, $domain ) = split( “@”, $email, 2 );
if ( strlen($local) > 64 || strlen($domain) > 255 ) return false;
if ( $check && !gethostbynamel( $domain ) ) return false;
return true;
# END
######
}
User names (for email) may contain:
- A to Z letters, upper and lower case.
- 0 through 9 digits
- . (fullstop, period) but not as the first or last character
- ! # $ % & ‘ * + – / = ? ^ _ ` { | } ~ – all are permitted.
The maximum length of the user is 64 characters; the domain is 255 characters; so with the @ a valid address could be up to 320 characters.
Further, did you know that user names are case sensitive (but domain names are not). Of course many email systems treat user names as case insensitive.
For information on domain name limitation you should see IANA.
Now you know more than most developers who write code that accepts or uses email addresses!

Related posts:
- Disposable EMail Addresses DEAs = Disposable EMail Addresses; they’re useful for you to provide to a vendor so that you can track the use of the email address...
- Domain Registrars In going through looking for a new domain hosting company I also looked to see about costs for domain registration. I can certainly tell you...
- Free Hosted Email If you have your own domain and you really don’t need web hosting you might want to consider hosted email servers from Microsoft or Google....
- Dynamic DNS Most broadband users have an IP address that is issued by their provider via DHCP or PPP (PPPoE technically); that address, generally, will not change...
- Email Readers I’m going to focus on Microsoft Email Readers… if you want to use Thunderbird it’s fine; but since Microsoft current has FOUR different email programs for...
- Free EMail… Right LOL Most of you probably think that the free email provider you’re using makes money by showing you those annoying advertisements when you access...
- Beware of vendors that support SPAM! I’ve know for a very long time that many websites that sell goods and services to consumers also sell (or trade) the email addresses they...
- Windows 7 for $29.99 Microsoft is offering students Windows 7 Home Premium (well, Windows 7 Professional if you say you must join a domain) for $29.99. The offer requires...
- Speeding Up Your Home / Small Office Network This will be the first in a multi-part post targeted at making suggestions as to how you can improve the performance of your home and...
- Remote Access I’ve been using a combination of bitvise WinSSHD and Tunnelier for remote access to my home network. It basically allows me to tunnel a RDP...

Discussion Area - Leave a Comment
You must be logged in to post a comment.