Storing mail in database, data type 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?
First, find out if "mail" guarantees that all data is utf8 or ascii or whatever.  If utf8, then use

MEDIUMTEXT CHARACTER SET utf8mb4


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

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

MEDIUMBLOB or LONGBLOB


(without a charset).