(I haven’t done this yet, but this is a sketch of what I’ll try.)
There are four classes of addresses on the existing system, all within virtual domains (all within vpopmail, really). There are regular addresses – inboxes.
There are forwarding addresses, aka .qmail files.
There are addresses that tie into ezmlm and run programs. .qmail files.
There are addresses that tie into mailman and run programs. .qmail files.
You can distinguish between ezmlm and mailman by the text in the .qmail file. Ezmlm has ezmlm commands in the text, and mailman has mailman commands in the text. Switch based on the content, and set up aliases accordingly.
So, to migrate, first scan for directories, peeking in to see that there’s a “cur” directory. If there is, it’s a maildir. If not, it’s probably an ezmlm config directory. Set up addresses for maildirs.
Then scan for the .qmail files. For each file, read the content. Based on the content, switch between making aliases for mailman, or logging a message about migrating an ezmlm list. No effort is made to migrate ezmlm lists, but the member list should be copied somewhere.
The importation should be done via a text file that logs all the email addresses, then all the forwards and aliases.
The text file can then be copied to the new machine, and a script can be run to turn the file into accounts.