dovecot can't handle/receive incoming emails

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

Sep 25 19:52:33 lmtp( 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

8 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

Hi @gustavorg, please advise how did you manage to coup with the situation as I'm facing similar challenge on my end

Thanks in advance

@G-ManiXSoftLab --

You realize you posted to a thread that's nearly 3 years old, right?

That being said, I use dovecot too. In my script that creates mail accounts, I explicitly create the directories new, cur, tmp under each top-level "folder" (INBOX, Sent, Junk, etc) for each email recipient. My script also sets the appropriate ownership and permissions of all this stuff.

Looking at the dovecot docs (and based on the fact that I do this explicitly), I'm pretty sure dovecot doesn't create these things…you do.

-- sw

Hi @stevewi


Thanks for the head-ups. Lemme try to explicitly create those directories.



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