Skip to content

Instantly share code, notes, and snippets.

@stefanszymanski
Last active April 30, 2020 14:45
Show Gist options
  • Save stefanszymanski/90feaf61ac1601627738bdbfae0472a4 to your computer and use it in GitHub Desktop.
Save stefanszymanski/90feaf61ac1601627738bdbfae0472a4 to your computer and use it in GitHub Desktop.
move IMAP mails to another account

Context

I had to move my mails from one account to another when my employer switched from self hosted mailing to an external service provider. In this process no mail adresses have changed. The only difference was the mailing server.

Prerequisites

  • mbsync/isync

Steps

  1. Set up and sync both accounts
  2. Configure one or more temporary channels for migration
  3. Sync temporary channels mbsync migrate-inbox
  4. Delete temporary channels from configuration

Channel configuration


# OLD ACCOUNT

IMAPAccount old
Host mail.old.com
User stefan

Channel old-inbox
Master :old-remote:inbox
Slave :old-local:inbox

# NEW ACCOUNT

IMAPAccount new
Host mail.new.com
User stefan

Channel new-inbox
Master :new-remote:inbox
Slave :new-local:inbox

# SYNC CHANNELS

Channel migrate-inbox
Master :old-local:inbox
Slave :new-local:inbox
Create Slave
Sync Pull
CopyArrivalDate yes
SyncState ~/.mail/imap-migration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment