Copy/move/synch IMAP account

Debian packages

  • isync - IMAP and MailDir mailbox synchronizer
  • mailsync - Synchronize IMAP mailboxes. Mailsync is a way of keeping a collection of mailboxes synchronized. The mailboxes may be on the local filesystem or on an IMAP server.
  • offlineimap - IMAP/Maildir synchronization and reader support
    • Synchronize your mail using a completely safe and fault-tolerant algorithm.
  • syncmaildir - Sync Mail Dir is a set of utilities to synchronize a pair of mailboxes

in Maildir format, using SSH to transfer data. It provides the smd-pull utility to pull changes made on the remote mailbox, smd-push to propagate local changes to the remote mailbox, and smd-loop to iterate push and pull in a timely way. Unlike OfflineIMAP, it does not require an IMAP server to be installed on the remote host

  • vdirsyncer - Vdirsyncer synchronizes your calendars and addressbooks between two storages.

3rd party

imapsync

copy_emails.sh
#!/bin/bash -eux
USER="username.surname"
LOGIN="${USER}@example.com"
PASS="userpass"
IMAP="imap.example.com"
 
SUBFOLDER=${USER/./_}
 
SUBFOLDER="archive-${SUBFOLDER}"
 
ARGS="--host1 ${IMAP} --user1 ${LOGIN} --password1 ${PASS}"
ARGS="${ARGS}  --host2 imap.destination.example.com --user2 archive@destination.example.com --password2 dest_pass --subfolder2 ${SUBFOLDER}"
 
#ARGS="${ARGS} --dry"
 
 
eval docker run gilleslamiral/imapsync /usr/bin/imapsync ${ARGS}

http://cmsj.net/2019/05/20/imapsync-docker.html