[Dovecot] deliver + quota

Timo Sirainen tss at iki.fi
Wed Nov 3 20:10:43 EET 2010

On Wed, 2010-11-03 at 11:38 +0100, Manuel Mausz wrote:
> >>> # Directory in which LDA/LMTP temporarily stores incoming mails >128 kB.
> >>> #mail_temp_dir = /tmp
> >> thanks for pointing that new configuration variable out. I've backported
> >> your patch to v1.2 and it's working fine now.
> >> I guess this temporary file is needed for supporting mbox but why is it
> >> needed for maildir?
> > 
> > It's mainly needed for Sieve, which needs to be able to read the mail before it decides where it should be saved to. Hmm. I guess I could see about disabling it entirely when Sieve isn't used.
> Isn't storing the mail inside Maildir/tmp sufficient for sieve? And then
> just hardlink (or copy, depending on the configuration) the file to
> Maildir/new or whatever sieve rules decides.

Yeah. Unfortunately there's a ton of layers that make this difficult to
implement. There are 3 different cases:

1) No sieve -> it should be possible to just call mailbox_save() with
the stdin input stream directly. I implemented this now to lda:

Doing the same for LMTP would require more code.

2) With Sieve, but it either doesn't read message at all or reads less
than the first 128 kB of it -> again there's no need to seek backwards
(no need for temp file), so mailbox_save() should get an input stream
that gets the already read data followed by not yet read stdio input
stream. But that gets annoyingly difficult to implement.

3) With Sieve that read more than 128 kB of input -> temp file needs to
be created. Yeah, it should be possible to hard link it into the final
maildir message. It needs to have the correct file permissions set up
(destination could be a shared mailbox), which gets a bit annoying to
implement. Also the temp file needs to exist for the entire duration of
the mail delivery, so if it crashes it leaves the temp file lying around
(now the temp file is unlinked immediately after creation).

More information about the dovecot mailing list