[Dovecot] Convert plugin

Egbert egbert at vandenbussche.nl
Fri Jul 30 18:01:27 EEST 2010

Op 30-7-2010 14:45, Daniel Luttermann schreef:
> Egbert wrote on 30.07.2010:
>> Op 30-7-2010 0:07, Daniel Luttermann schreef:
>>> Egbert wrote on 29.07.2010:
>>>> Hi,
>>>> I'm trying to convert users from a sendmail server to a postfix/dovecot
>>>> server. All works fine but one of the last things is to rescue the
>>>> messages in /var/mail/<user>   on the old server. This seems very
>>>> straitforward using the convert plugin but with the settings from the
>>>> wiki, nothing happens when the user logs in. Do I need a private
>>>> namespace for this as suggested elsewhere in the wiki?
>>> No hint in the logfile? Maybe a permission problem or Dovecot can't
>>> find any emails? If nothing is logged maybe it helps when you set
>>> "mail_debug=yes" in dovecot.conf?
>>> Btw: it seems that in the upcoming Dovecot 2.0 version there's no
>>> convert plugin available anymore - with 2.0 you can use "dsync" to
>>> convert emails between different mailbox formats.
>>> --
>>> Daniel
>> Yeah, the obvious place to look. There I found out that the plugin looks
>> for a direcory in /var/mail/ called<user>  and in that directory a
>> mailfile called 'inbox' is expected.
>> So I have now the convert in imap and pop3 chapters of dovecot.conf and
>> enabled the plugin in the plugin section:
>> protocol imap {
>>     mail_plugins = convert
>> }
>> protocol pop3 {
>>     mail_plugins = convert
>> }
>> plugin {
>>     convert_mail = mbox:/var/mail/%u
>> }
>> So things finally start to work. Only the rename of the /var/mail/<user>
>> directory doesn't work yet. Wrong owner. I made /var/mail owned by
>> vmail:vmail but that is not good. Maybe it should be owned by dovecot.
>> Who is the owner of the convert process?
>> EJ
> I think that vmail should be the correct user/group for this but it
> could be a problem if the source and destination directories are the
> same (home directory is the same as mail_location).
> Have you set a different mail location? I think Dovecot can't rename
> the old directory if the new mail location is in the same directory.
> --
> Daniel

The renaming of the maildir fails, wrong user. I can fiddle this out. 
Perhaps the /var/mail tree should be owned by user dovecot. Dunno, have 
to try. If all fails, I give the mailbox 777 during the conversion...

There are no /home/<user> mboxes on the old server since the (virtual) 
users have no home dir. On the new system all mail is owned by vmail. 
Again the users are virtual and are in MySQL databases 

On the new server all users use Maildir structure in 
/home/vmail/<domain>/<user>. The old postfix mail is made available on 
the new server in /var/mail/<user> by copy or nfs to facilitate the 
conversion of old messages to Maildir. That structure does not work as 
we know, there must be a directory in between.
With some scripting I could make the old mail appear as 
/var/mail/<user>/inbox on the new server. Doing this makes this approach 
more ore less the same as a big bang conversion using mb2md.pl with the 
same (dis?)advantages (user not in control when things happen). We have 
quite a few dormant users too; would be nice to be able to trace them 
and kick them of the new server.

Egbert Jan

More information about the dovecot mailing list