[Dovecot] zlib plugin

guenther guenther at rudersport.de
Sat Apr 7 03:08:56 EEST 2007

Good evening, folks,

Well, here at least. ;)  I recently found out by accident about support
for gzip compressed mbox files. While this is great for archives to keep
wasting of space down to a minimum, unfortunately it is read only -- no
support for rw access.

Is implementing write access by any chance planned for future releases?

Now for the spoiler. :)  I mentioned, I found out about this feature "by
accident", reading the NEWS for RC29. Talking to some guys on IRC I
realized I am not the only one who found out about this by the release
announcement. However, no one (around) was able to tell me how to use
it, though interested too.

I couldn't find any info in the docs, and google wasn't helpful either.
But another careful look at the security announcement (especially the
few words about it being a plugin not commonly used) got me going. So I
figured, I'd mention it here -- I'm sure others have been wondering
about this themself. And maybe google will pick up this post eventually.

Of course, just sticking a gzipped mbox file inside your mail dir
doesn't work...

Inside the protocol imap section of the configuration, you need to
enable the zlib plugin (and maybe set mail_plugin_dir, though the build
time default should do). Basically, that's it -- once this is done, the
naive first attempt magically works. ;)

  mail_plugins = zlib

Of course, restart dovecot. Also, the gzipped mbox file needs to have
a .gz suffix. This works for mbox files gzipped in one fell swoop just
as well as incrementally concatenated single gzipped mails, as served by
some mailing list servers as archives. Keep in mind though, that these
archives are read only.

With one notable exception: Read/Unread status is being updated and
saved, as it will be stored in the index files in this case. This
probably holds true for flags too, though I didn't test it.


char *t="\10pse\0r\0dtu\0. at ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}

More information about the dovecot mailing list