Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql field size for storing email body

Tags:

mysql

field

size

I want to store contents of email body into MySql. What would the correct type&size of the field be? Can varchar() provide enough storage size? Is there a limitation in the email body's length?

Thanks in advance.

like image 581
CdB Avatar asked Jul 20 '11 18:07

CdB


People also ask

How long should an email field be in a database?

So over the last few months, the average email address we saw was 21.9 characters long. If you want your form to accommodate 80% of the email addresses, you need to display 28 characters. And if you want 95% of your web visitors to be able to see what they typed, you need to show at least 31 characters.

Which field type can store email?

a varchar(50 ) would be enough for storing email..

How do I save an email body in a SQL database?

Just use varchar(max) as it will be the easiest option to keep all data in the database so you can migrate, replicate or whatever the database and everything will be kept intact.

Can I use varchar for email?

you can use varchar as your data type for email column as emails are usually composed of letters, numbers and special characters. The right value of data length for the email field is database-agnostic. If you are also considering standard SQL types, the same can be said for data type, that is a string.


2 Answers

You will need to use blob or text types. There is no limit on the length of an email body.

like image 185
Jacob Eggers Avatar answered Oct 05 '22 22:10

Jacob Eggers


"A BLOB is a binary large object that can hold a variable amount of data"

http://dev.mysql.com/doc/refman/5.5/en/blob.html

like image 45
Joshua Avatar answered Oct 06 '22 00:10

Joshua