1

I am trying to setup a mail server, I went over tons of tutorials on how to do this with Postfix + dovecot + MySQL, but none was error-proof and I always got stuck at some point with an error, so I decide to configure the mail server step by step by my own, so far I have installed Postfix and ViMbAdmin as my postfix-admin interface, I managed to link the database with Postfix, everything is fine but one! The Postfix would not auto-create the Maildir for incoming mails.

The following is a sample mail.log output for an incoming email:

postfix/smtpd[22086]: connect from mail-lf0-f45.google.com[209.85.215.45]
postfix/smtpd[22086]: C92B461E5B: client=mail-lf0-f45.google.com[209.85.215.45]
postfix/cleanup[22090]: C92B461E5B: message-id=<BLAH@mail.gmail.com>
postfix/qmgr[21732]: C92B461E5B: from=<BLAH-SENDER@gmail.com>, size=4535, nrcpt=1 (queue active)
postfix/virtual[22080]: C92B461E5B: to=<BLAH-RCVR@XXX.net>, orig_to=<BLAH-ALIAS@XXX.net>, relay=virtual, delay=0.13, delays=0.13/0/0/0, dsn=4.2.0, status=deferred (delivery failed to mailbox /var/mail/vhosts/XXX.net/BLAH-RCVR/mail: unable to create lock file /var/mail/vhosts/XXX.net/BLAH-RCVR/mail.lock: No such file or directory)
postfix/smtpd[22086]: disconnect from mail-lf0-f45.google.com[209.85.215.45]

If I manually create the /var/mail/vhosts/XXX.net/BLAH-RCVR/ directory, everything will go fine. I want the application auto-create the directory so I don't have to create it for every user I add to system!

What am I missing in here?


P.S: I've double checked the permission on /var/mail/vhosts/ the postfix should be able to RWX the directory.

1
  • I know that postfix-admin does it but not postfix itself. I don't know ViMbAdmin but I suppose that's where you need to focus to find the solution. – Julie Pelletier Jun 24 '16 at 7:07
1

I don't know postfix-admin nor ViMbAdmin but creating a maildir is as simple as:

mkdir -p $USERHOME/Maildir/{new,cur,tmp}
chown -R <mail user>,<mail group> $USERHOME/Maildir
chmod -R 700 $USERHOME/Maildir

where $USERHOME is the mailbox home directory (virtual user home directory).

You can write a simple bash script to run every time you create a new mailbox, or you could somehow insert that script in the ViMbAdmin mailbox creation process.

Another solution is to utilize Dovecot LMTP server to deliver local mail, instead of postfix LDA (see Dovecot LMTP documentation). It creates maildirs and has much more features (sieve scripting for example).

Regards

Paolo B.

-1

This is the job of the LDA (local delivery agent).

See the complete install example for Ubuntu (13.10 so slightly old): https://github.com/opensolutions/ViMbAdmin/wiki/Mail-System-Install-on-Ubuntu

If followed, this absolutely works fully :-D

And see the configuration for the LDA: https://gist.github.com/barryo/8918488#file-dovecot-15-lda-conf

1
  • Please provide the actual answer and not just links. – user5870571 Jun 24 '16 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.