views:

301

answers:

4

Possible Duplicate:
What is the optimal length for an email address in a database?

What would you put as the length of an email address field?

In the db I look after we have nvarchar(60) but this seems arbitrary.

Is there a maximum length I can allow for or are email address lengths unbounded?

EDIT this is a dupe of
http://stackoverflow.com/questions/1199190/what-is-the-optimal-length-for-an-email-address-in-a-database

please close

+1  A: 

Something like 64 or more, but in any case make sure that you always truncate the user input (to 64). You don't want to be missing important information (user entry) just because the email was longer than you expected.

cherouvim
+1  A: 

Is this for storing the contents of an entire email in the database? In this case I'd use the database type text rather than char or varchar, as emails can be of arbitrary length.

Adamski
He's probably talking about the address, not a mail body.
balpha
yes address not body i've edited question to be clearer
John Nolan
Wicked - I got downvoted ... Thanks whoever that was! Note that I **qualified** my answer based on this being the email body.
Adamski
i've up voted you so you get 8 now - thanks for the response
John Nolan
+4  A: 

This wikipedia article contains some useful background information.

You should be safe with 256 characters.

Aaron Digulla
+3  A: 

The maximum length of an email address is 320 characters.

Every email address is composed of two parts. The local part comes before the '@' sign, and the domain part follows it. In "[email protected]", the local part is "user", and the domain part is "example.com".

The local part must not exceed 64 characters and the domain part cannot be longer than 255 characters.

In sum, an email address can be 320 characters long at most.

http://stackoverflow.com/questions/1199190/what-is-the-optimal-length-for-an-email-address-in-a-database

Iain Hoult
thanks Ian looks like I've asked a duplicate.
John Nolan
[email protected] about the foobar part? is this included in the 320 characters limit?
cherouvim