If 1And1 is just a standard mailserver, you could use imapsync
I have used this to migrate my mail from 1 VPS to another, I used to have a Zentyal server (Ubuntu server based) and migrated to NethServer.
Make note of:
if you don’t know the password of you user, and you are migrating from two NS that are both under your administration, you can use the master user of dovecot where the admin is root in NS (bear in mind to activate the option ‘Root can log in as another user’ in the /email/Mailboxes panel of nethgui). Of course you still need to write the pass file the password of your root user.