Dovecot supports both mbox
and maildir
format to store emails. I searched its docs for storing all emails in MySQL
database but i coundn't find it.
Is it possible to tell dovecot to store all outgoing and incoming emails in a database?
Storing emails in database can really be very flexible for searching emails for a keyworks in email etc..
How go GMAIL store its email? Is its based on maildir format?
Maildir is able to perform FTS within messages so you have to enable an appropriate plugin. Further reading is here: http://wiki2.dovecot.org/Plugins/FTS
Also, mysql as well as other RDBMS are not well suited to manage email messages, so dovecot has its own indices and search mechanisms - fast and efficient.