[Dovecot] Is it safe to manipulate Maildir files directly?

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Tue Nov 5 09:22:57 EET 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 4 Nov 2013, David Henkel-Wallace wrote:

> is it safe to manipulate files in Maildir/xxx directly or will Dovecot

if "xxx" does not include the Dovecot-related index files etc., then yes.

> become unstable if I don't make these changes by talking to Dovecot and 
> having it make the changes?  (I'm running 2.1.7 under Wheezy, IMAP only)
>
> My specific application: I am running spamassassin and would like users 
> to be able to submit spam (and ham) directly by moving it into special 
> folders.  A cron job can then find it and take action: feed spam 
> messages to the bayesian trainer and then delete them; feed ham messages 
> to the trainer and then move them into ~/Maildir/cur/

I did this before switching to antispam.
I use antispam with spool2dir now, that central directory has a inotify 
watcher that trains the messages instantly.

> Having the cron job find the messages and train spamassassin is no 
> problem.  The question is how to move the messages.  Is it safe to 
> simply rename the files from my cron job?

You mean "ham -> ~/Maildir/cur"? Yes, but there is a slight chance, that 
an user already copy'ed the message there. If the stem of the filename, 
the part before the colon ":", is already present in the Maildir/cur or 
~~/new, Dovecot might gets confused. I think all present versions generate 
an error in the sense "duplicate found, fixed by renaming into something".

I did not moved the message files from "ham" into the INBOX. I named the 
folders: spam/yes and spam/no, all my users moved messages into spam/yes, 
but copied them into spam/no and moved them themselves into their correct 
mailbox. Maybe, you can avoid that step, too.

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBUnic0V3r2wJMiz2NAQKywgf/f2ZE+U1NzCVkAAgwASdsv79SxrqNkrf/
+G+2HyBgFfRqk3TchPjVp3GYxFZjLhVZT5GhvU3P1RGfbgv+WKiGfaHSF5FGXVfv
u16xcdHkyBBikwyT1YQ8rsO6YAIgUmUEoUIkrQGqdN40NpBx6TgIZZjmhyVTlr4g
Nda9A+7dEAfvwyaXJSUxVPIjZC0+CONJ6+o4Wm+taXLbBAnb7brHAly8+ovjjvAt
S5wyrPefR9U7N3U2ENyeZI7okib+qKNDIZ5AaMOdcP2ZHvebjJMLPA524glzBWyu
1Hq7OHabfLcugThlHTXr3WxKBMACiA2J5uNOxH4A3hxQmB+x7S7NqQ==
=VZIk
-----END PGP SIGNATURE-----


More information about the dovecot mailing list