Home / Email Marketing / Valid Email Address Length
email address

Valid Email Address Length

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
######
}

About Douglas Karr

Douglas Karr is the founder of The Marketing Technology Blog. Doug is the CMO of CircuPress and CEO of DK New Media, an agency specializing in assisting marketing technology companies with their inbound marketing - leveraging social media, blogging, search engine optimization, pay per click and public relations. Their clients include Angie's List, GoDaddy, Mindjet and many more. Douglas is also the author of Corporate Blogging for Dummies.

Check Also

SPAM Analysis

Why and How to Verify Your Email Marketing Lists

Email marketing is a blood sport. In the last 20 years, the only thing that’s ...

9 comments

  1. I’m glad someone found that useful! Searching on Google for “email regexp” reveals a lot of regular expressions that don’t sync up with the RFC.

  2. Yes, I noticed the lack of compliance of other solutions with the RFC as well. I have noticed, though, that even this regex is atypical and not the standard. I remember reading the actual regex (allowing < ,>, , etc) is too intensive for most processes.

    However, it’s written succinctly and definitely a solution that should be acceptable to any enterprise email application.

    Thanks, Again!
    Doug

  3. Unfortunately, I linked that page to the wrong RFC (2821 instead of 2822) but that’s been corrected. The angle brackets can not be part of the local or domain parts of an email address; rather, they represent tokenization points, i.e. they can be used to surround an email address (for instance in your mail reader) precisely because they can not be part of the address.

    One thing that my function doesn’t do is worry about the quoted form of email addresses — where the local part appears in double quotes — because RFC2821 essentially says that no one should ever have to write their address that way. (I believe the form is for backwards compatibility and is now bad practice.)

  4. Actually RFC2821 IS the correct reference for the email address length. I found it there, but not in RFC 2822.

  5. There is a restriction in RFC 2821 on the length of an address in MAIL and RCPT commands of 256 characters. The upper limit on address lengths should normally be considered to be 256.

    — Source: RFC 3696 Errata

    Also, because RFC 2181 says “A full domain name is limited to 255 octets”, it’s repeatedly misinterpreted by people (including the writers of other RFCs) as meaning that domain names can be 255 chars long. But RFC2181 is talking about DNS protocol-level representation on the wire, not printable characters.

    The maximum length of a domain name is 253 chars (254 including trailing dot, 255 octets on the wire with terminating null). And that is what BIND and DiG implement.

  6. Developers underestimating the potential sizes of email addresses has caused a few problems: http://www.eph.co.uk/resources/email-address-le

    I guess if your email address is something tiny like “jack1983@aol.com” you might think even 30 characters is generous.

  7. Sorry, the above URL is broken…

    Developers underestimating the potential sizes of email addresses has caused a few problems:

    http://www.eph.co.uk/resources/email-address-leng

    I guess if your email address is something tiny like "jack1983@aol.com" you might think even 30 characters is generous.

  8. Just found this post…hilarious. I’m wondering now if i can register that domain lol.

Leave a Reply