I've found pretty poor informations about mail databases.

My need is to archive mail messages downloaded from a normal pop3 or imap account: I am an ordinary user and I do not own the server, but just the mailbox. So I should exclude solutions like dbmail, suggested in other answers.

Two questions:

1) can MySQL be used for this purpose?

2) If yes, which is the best data type to be used for the column which will contain the body of the mail? It can include attachments (represented as sequences of characters, as you know) and its length is definitely unpredictable: it may vary from a few bytes to several MiB and it should not impose a (small) upper limit to the design. It should have a decent performance, if exists.

In brief: which is the most common approach when handling this kind of data with a MySQL database?

1 Answer 1


First, find out if "mail" guarantees that all data is utf8 or ascii or whatever. If utf8, then use


for a limit of 16MB. For a 4GB limit, change to LONGTEXT.

If the mail is not forced into some character encoding, then use


(without a charset).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.