It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

How long should emails be?

Moderator: Malcolm

How long should emails be?

Postby nighthawk on Mon Sep 25, 2006 7:14 pm

How many characters email address have. I usually put VARCHAR(30) in database for storing emails, but is there emails longer than this.

What is optimal length of field in database for email?
User avatar
nighthawk
250+ Club
 
Posts: 420
Joined: Sun Jun 11, 2006 1:53 pm
Location: SFRJ

Postby nighthawk on Thu Sep 28, 2006 1:38 pm

I found answer to this question 150 - 200 if you want to be safe.
The Zeitgeist Movement
User avatar
nighthawk
250+ Club
 
Posts: 420
Joined: Sun Jun 11, 2006 1:53 pm
Location: SFRJ

Postby rse on Fri Nov 03, 2006 9:18 am

I've taken a bit of a scientific approach to this question.

An email address could potentially be split up into at least 4 sections i.e. firstname.surname@domain.com

The longest name I could find in the English language is pneumono­ultra­micro­scopic­silico­volcano­coniosis, which has 45 characters. It is possible that the firstname and surname could be 45 characters long so that would be 90 characters in total. It is then common for a user to separate their names with either an underscore or a hyphen, so that's 91 characters in the first section.

For the domain part, including the @ symbol, a domain name can be upto 64 characters for most registries, although a domain can theoretically be upto 257 characters (inc. @) however this is highly unlikely, so we assume 64.

Next we have the domain suffix i.e. .com/.co.uk etc. The maximum this can be is xxx.xx, so 6 characters.

So if we add it all together we've got 91 + 64 + 6 = 161 characters. I think this figure would be worst case and should allow for all eventualities.

I hope this helps!
Adam Williams
PHP Web Developer

Personal: http://30things.net
Blog: http://www.root-servers.co.uk
User avatar
rse
100+ Club
 
Posts: 141
Joined: Sun Oct 10, 2004 8:15 pm
Location: Leeds, UK

Postby nighthawk on Fri Nov 03, 2006 8:45 pm

Thank you, nice work finding the longest word in English language.
The Zeitgeist Movement
User avatar
nighthawk
250+ Club
 
Posts: 420
Joined: Sun Jun 11, 2006 1:53 pm
Location: SFRJ


Who is online

Users browsing this forum: No registered users and 0 guests