Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Ubuntu: mailserver + database

I want a mailserver on Ubuntu that saves e-mail in the database and uses users in the database to let them login into the POP server and SMTP server. There are also different domains. How can I do this?

share|improve this question

migrated from Apr 21 '11 at 13:34

This question came from our site for computer enthusiasts and power users.

marked as duplicate by mrdenny Nov 22 '11 at 12:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

What you're looking for is dbmail

DBMail is an open-source project that enables storage of mail messages in a relational database. Currently MySQL, PostgreSQL and SQLite can be used as storage backends. Commercial development and support is also available.

share|improve this answer

If you want to setup a Web-fronted mail server with users managed in a database, the easiest is perhaps Postfix + Squirrelmail, and then you can throw in MailScanner + ClamAV and SpamAssassin for antivirus and spam protection. The setup will cope with multiple domains

Start here:


share|improve this answer

It depends on what you mean exactly with database.

If you want to store mail into a (real) RDBMS you could indeed use dbmail. In don't really see the advantage in day to day use of email of a RDBMS, though.

If you mean that you want to store mail on a server for several users you may not want to use a POP mail server. Instead, you want to use an IMAP server. IMAP keeps the mail incl. subfolder structure and read/unread info on the server, allowing the users to view their mail from an arbitrary mail client that knows IMAP, including webmail applications.

Standard IMAP mail servers for Ubuntu are Courier, Cyrus and Dovecot. To store login credentials for your users openLDAP would be a good choice. The complete picture would probably involve :

  • a MTA like Postfix or Exim
  • a IMAP server like Courier, Dovecot or Cyrus
  • a dbase like MySQL or OpenLDAP for login credentials/user info.
  • several mail filter utilities to wheat out spam, like clamav, spamassassin, greylistd and razor.
  • maybe a webmail application like squirrelmail or horde.

You could such a setup even if you wanted to store the mail in a database. You could export email (in the background) to a (very) fast database like CouchDB and do al the analyses from their. A chapter in 'Mining the Social Web' by O'Reilly seals with a scenario like that, BTW.

share|improve this answer