Valid Email Address Length

0 Shares
Valid Email Address Length
0 Flares Twitter 0 Facebook 0 StumbleUpon 0 Google+ 0 LinkedIn 0 Buffer 0 Reddit 0 Pin It Share 0 Email -- 0 Flares ×

I had to do some digging today to find it, but did you know what the valid length of an email address is? It’s actually broken into parts… Name@Domain.com. This is according to RFC2822.

  1. Name can be 1 to 64 characters.
  2. Domain can be 1 to 255 characters.

Wow… that means that this could be a valid email address:


loremaipsumadolorasitaametbaconsectetueraadipiscin
gaelitanullamc@loremaipsumadolorasitaametbaconsect
etueraadipiscingaelitcaSedaidametusautanisiavehicu
laaluctuscaPellentesqueatinciduntbadiamaidacondimn
tumarutrumbaturpisamassaaconsectetueraarcubaeuatin
ciduntaliberoaaugueavestibulumaeratcaPhasellusatin
ciduntaturpisaduis.com

Try fitting that on a business card! Ironically, most email address fields are limited to 100 characters on the web. That’s actually not valid. If you’d like to validate an email address for proper construction utilizing PHP, I found this snippet on the net:

<?php function isValidAddress( $email, $check = false )
{
##############################
# PHP Email Address Validator
# (C) Derrick Pallas
#
# Authors: Derrick Pallas
# Website: <a href="http://derrick.pallas.us/email-validator/">http://derrick.pallas.us/email-validator/</a>
# License: Academic Free License 2.1
# Version: 2006-12-01a
if (!ereg(''
. '^'
. '[-!#$%&amp;'*+/0-9=?A-Z^_a-z{|}~]'
. '(\.?[-!#$%&amp;'*+/0-9=?A-Z^_a-z{|}~])*'
. '@'
. '[a-zA-Z](-?[a-zA-Z0-9])*'
. '(\.[a-zA-Z](-?[a-zA-Z0-9])*)+'
. '$'
, $email
) ) return false;
list( $local, $domain ) = split( "@", $email, 2 );
if ( strlen($local) > 64 || strlen($domain) > 255 ) return false;
if ( $check &amp;&amp; !gethostbynamel( $domain ) ) return false;
return true;
# END
######
}

Related