[Dovecot] Convert plugin

Egbert egbert at vandenbussche.nl
Tue Aug 3 23:44:38 EEST 2010


Op 30-7-2010 21:44, Timo Sirainen schreef:
> Instead of using convert plugin, you could run mb2md.pl also as post-login script. Probably easier.. http://wiki.dovecot.org/PostLoginScripting

Indeed this seems to work. Thanks. One problem: The login is denied the 
first time (user/passw not correct). The /var/mail/<user> IS converted 
though. Cannot find any hint where to look in the logs... A second 
attempt logs the user in and the converted messages are displayed as unread.

In dovecot.conf:
protocol imap {
   #mail_executable = /usr/lib/dovecot/imap
   mail_executable = /home/egbert/script.sh

The script in /home/egbert:
#!/bin/sh
#
# no mbox in homedir, only in /var/mail
/home/egbert/mb2md.pl -S -W -s /var/mail/egbert -d $PWD
#
# make copied messages ownd by vmail
chown vmail:vmail $PWD/cur/*
#
# disable double conversion
mv /var/mail/egbert /var/mail/egbert-converted
#
# continue to run imap
exec /usr/lib/dovecot/imap "$@"


$PWD = /home/vmail/vandenbussche.nl/egbert
All is hardcoded for testing; I will use suhstrings of $USER to make 
this more general. Since the script runs as root, it is not very 
importand how /var/mail ownerships looks like.

Egbert Jan


More information about the dovecot mailing list