4

I want to set up a mail server using postfix and dovecot, that stores mail using the maildir format, and I don't want any of these files to go in user's home directories. Wherever I search for how to make postfix use maildir, they just say to set

home_mailbox = Maildir/

but this places mail in the home home directory.

dovecot nicely lets you specify any path, and also gives you %u to customize it, so I set it to

mail_location = maildir:/var/mail/users/%u/:INBOX=/var/mail/users/%u/INBOX

I don't really mind moving the INBOX around, as long as it's not in /home, but I can't find any way to do this. I don't want to bother with virtual users, or procmail, or anything.

zacaj
  • 143
  • 1
  • 4
  • It seems to be possible according to a short (2min) search. See for example [Postfix auto create Maildir](http://serverfault.com/q/219537/217116) or [Dynamic Maildirs and LMTP]. They are using database for looking the dirs up, but you can also use simple files. Do these topics answer your question? – sebix Jul 31 '14 at 09:15
  • this still seems to be creating them in the home directories, and I'd rather not use virtual users if I don't have to – zacaj Jul 31 '14 at 13:40

1 Answers1

6

Since you've already configured Dovecot, the easiest solution to your problem is to use deliver from Dovecot as the mail delivery agent (MDA).

This could be done by adding this line to main.cf (paths may vary according to your distribution, on Debian it's /usr/lib/dovecot/dovecot-lda):

mailbox_command = /usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"

If you got a larger scale installation and want to use virtual users, you've got to setup a service in master.cf accordingly, e.g. like this:

dovecot   unix  -       n       n       -       -       pipe
flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/dovecot-lda -f ${sender} -d ${recipient}

Of course you shouldn't use those without carefully crafting your own configs.

Further information can be investigated here:

http://wiki2.dovecot.org/LDA/Postfix

sebix
  • 4,175
  • 2
  • 25
  • 45
Marc Stürmer
  • 1,894
  • 12
  • 15