dovecot can't handle/receive incoming emails

I'm getting this error in /var/log/dovecot.log

Sep 25 19:52:33 lmtp([email protected]): Error: stat(/var/mail/vhosts/ failed: Not a directory

(my own domain replaced by for privacy)

The dovecot + postfix + mysql configuration is exactly like described in this tutorial

I really checked every step several times, googled by 6 hours and no success.

My current mail_location value in /etc/dovecot/conf.d/10-mail.conf is

mail_location = maildir:/var/mail/vhosts/%d/%n

I already played with variables like mailtempdir, namespaces, others.

Please help

5 Replies

Is the location referenced in the error a directory? or a file? From the error message, it looks like it should be a directory and maybe it is finding a file named 'tmp' there.

/var/mail/vhosts/ is suppose to be a file and according to

mail_location = maildir:/var/mail/vhosts/%d/%n

it's suppose to be a file.


dovecot is trying to store the email in a folder called


the question is why and how to fix it.

/var/mail/vhosts/ is generated correctly as %d is traslated to the domain name and %n is traslated to the name in

Related to @mparson comment:

I know that /var/mail/vhosts/ is suppose to be a file because at the testing part in the guide

you must read the emails using the command

sudo mail -f /var/mail/vhosts/

ergo, /var/mail/vhosts/ is suppose to be a file.

You're using maildir, which means the it needs to be a directory.

Correct, it must be a directory. It's fixed and working now. The problem is the mentioned guide

didn't say anything about create that directory, so I suppose it should be created automaticaly by dovecot. Unfortunately for some reason I need to investigate, dovecot created as a file no as a directory.

Thanks a lot @mparson


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct