Postfix + Dovecot + Maildir + IMAPs

In my quest to move away from UW-Imap I needed a new IMAP/POP3 server to store my mail. Specifically I needed one that supports Maildir as my old mbox mailboxes with 5000+ messages in them were just too slow. Fedora Core 3 comes with both Postfix and Dovecot, SMTP and IMAP/POP3 servers respectively, so setting it up is really quite simple. One word of warning, Cyrus-IMAP also comes with Fedora Core 3 but I highly recommend staying away from it. It's much more complicated and only really neccessary if you have a lot of users you want to host mail for. In my case I'm hosting mail for less than 10 users so Dovecot is perfect!

First install Postfix, and Dovecot, and remove sendmail:

yum install postfix
yum install dovecot

yum remove sendmail

Next configure postfix (/etc/postfix/main.cf) to deliver mail to Maildir directories instead of the default mbox. I'm also assuming you already know how to configure Postfix to accept mail for the domain youo want it be authoritative for.

home_mailbox = Maildir/

Send a message to a local user and check the maillog to make sure it was delivered correctly. Messages to that user should be stored in:

/home/(user)/Maildir/new

Assuming mail is getting delivered to that user's mailbox simply start Dovecot and login with that username/password. Dovecot only listens on IMAPs by default, edit the /etc/dovecot.conf to enable any other protocols you want to run (IMAP, POP3, or POP3s).

Dovecot will use a generic SSL cert with localhost.localdomain as the server name. You can make your own cert using the following command:

openssl req -new -x509 -nodes -out /tmp/public.pem -keyout /tmp/private.pem -days 3650
cp /tmp/public.pem /usr/share/ssl/certs/dovecot.pem
cp /tmp/private.pem /usr/share/ssl/private/dovecot.pem

service dovecot restart

Done! Grand total of about 10 minutes of tweaking to get a fully workable SMTP/IMAP/Maildir solution.

Note: I even configured Postfix to have procmail process and deliver the mail which gives even more flexibility. Just remember to have your .procmailrc deliver to Maildir directories (directories ending in a /) as the default is mbox.

Leave A Reply - 13 Replies
Replies
subhasha 2005-08-29 05:01am - subhasha_hl@... - Logged IP: 61.11.57.55

Hi, What is the mailbox_transport and same in master.cf ?

Subhasha

dimcha 2005-09-12 01:31am - trash@... - Logged IP: 193.125.207.16

worst how-to that I saw in my life

technick 2005-10-05 03:16pm - No Email - Logged IP: 168.28.19.104

I agree.. worst how to ever.. I suggest you take a lesson out of TLDP and learn how to right documentation. Good Luck

Paul Johnson 2006-01-27 10:43pm - pauljohn32 AT gmail DOT com - Logged IP: 24.124.123.243

This helped me out quite a bit. Thanks. I installed cyrus-imap first, but the configuration was too hard.

To answer the other user's question, the mailbox_transport field for me is not set when using dovecot. It was necessary for cyrus, but I had to remove it in order to have dovecot deliver mail to users.

Petre Scheie 2006-02-28 07:24am - No Email - Logged IP: 63.225.142.21

This helped me, too. The dovecot SSL cert on my FC3 box had expired and I just wanted to generate a new one. The steps above had me back in business in about five minutes. Thanks.

leniuch102 2006-04-06 03:36pm - No Email - Logged IP: 83.14.20.138

Thanks. The postfix/Maildir tip really helped me :).

userabuser 2007-01-24 10:00pm - No Email - Logged IP: 69.19.14.24

Very straight-forward and helpful. For Debian ...

apt-get install postfix apt-get install dovecot

Edit /etc/dovecot/dovecot.conf

Protocols we want to be serving:

imap imaps pop3 pop3s

protocols = imap imaps

Edit /etc/postfix/main.cf home_mailbox = Maildir/

After you send a mail to yourself the the Maildir folder will be created in your home folder.

For my debian install, the cert directories were as follow. cp /tmp/public.pem /etc/ssl/certs/dovecot.pem cp /tmp/private.pem /etc/ssl/private/dovecot.pem

/etc/init.d/dovecot restart

F. Billard 2007-02-14 03:06pm - No Email - Logged IP: 66.199.184.254

More details would have been nice especially since dovecot doesn't seem to have any real documentation. (A wiki written by people who don't understand the idea of editing doesn't count.) But it's not nearly so bad as Dimcha and Technick state. In particular, Technick, before giving advice on writing documentation you might want to learn to speak English. I know most of the people posting stuff on the net are functionally illiterate, but -- "learn how to RIGHT documentation"? That's pretty pathetic.

Netopia 2007-04-06 07:49am - No Email - Logged IP: 209.122.102.2

While I tend to agree with F. Billard, there is the possibility that Technick is smarter than he appears... perhaps by "...learn how to RIGHT documentation" he meant "...learn how to correct documentation (now that it's already been written poorly)", but I doubt it!

Joe

Craig Macdonald 2007-07-16 03:22pm - No Email - Logged IP: 130.209.241.193

many thanks, this helped me replace my SSL certificate for dovecot when it expired.

Sphinx 2007-11-20 01:36pm - No Email - Logged IP: 70.102.225.10

I liked the short form, just enough to get up and running quick.

Seth 2008-08-08 03:08am - No Email - Logged IP: 80.126.70.3

Just adding my vote for the short form. I love that. No reading through piles of options I have configured years ago. Just the simple meat of getting Maildir working with this set of tools. Splendid, thanks

kitten 2008-09-19 09:17am - No Email - Logged IP: 80.96.67.15

Thanks alot for the howto. I like the short form, and the fact that it gives the minimum knowhow. I found the information I was looking for. But I must also agree with the people that complained, the tutorial is pretty basic and could be extended without endangering the ease of understanding and reading it... And for the people arguing here: no, the ability to judge a tutorial or to configure an email server has nothing to do with the ability to speak english. I'm pretty sure english isn't technik's mother language. Neither is it mine, so please don't make fun of me if I have hilarious mistakes... ;)

All content licensed under the Creative Commons License