2020-06-17

IMAP Sync CLI

 17 Jun 2020  Gists

IMAP Sync CLI

Install standard Ubuntu packages (run apt-get update && apt-get upgrade -y first):

sudo apt-get install  \
libauthen-ntlm-perl     \
libclass-load-perl      \
libcrypt-ssleay-perl    \
libdata-uniqid-perl     \
libdigest-hmac-perl     \
libdist-checkconflicts-perl \
libencode-imaputf7-perl     \
libfile-copy-recursive-perl \
libfile-tail-perl       \
libio-compress-perl     \
libio-socket-inet6-perl \
libio-socket-ssl-perl   \
libio-tee-perl          \
libmail-imapclient-perl \
libmodule-scandeps-perl \
libnet-dbus-perl        \
libnet-ssleay-perl      \
libpar-packer-perl      \
libreadonly-perl        \
libregexp-common-perl   \
libsys-meminfo-perl     \
libterm-readkey-perl    \
libtest-fatal-perl      \
libtest-mock-guard-perl \
libtest-mockobject-perl \
libtest-pod-perl        \
libtest-requires-perl   \
libtest-simple-perl     \
libunicode-string-perl  \
liburi-perl             \
libtest-nowarnings-perl \
libtest-deep-perl       \
libtest-warn-perl       \
make                    \
cpanminus -y

Get latest release from https://github.com/imapsync/imapsync/releases

Extract, test, and copy binary to PATH:

wget https://github.com/imapsync/imapsync/archive/imapsync-1.945.tar.gz

tar xzvf imapsync-1.945.tar.gz && rm imapsync-1.945.tar.gz

cd imapsync-imapsync-1.945/

./imapsync

cp imapsync /usr/bin/

Example dry run migration (Office 365 to Zoho Mail):

imapsync --host1 outlook.office365.com --user1 [email protected] --password1 '@Aa90210!' --host2 imappro.zoho.com --user2 [email protected] --password2 '[email protected]!' --noautomap --f1f2 "Deleted Items=Trash" --f1f2 "Sent Items=Sent" --f1f2 "INBOX=Inbox" --folderrec "INBOX" --folder "Sent Items" --folder "Deleted Items" --justfolders --dry "[email protected]"

Additional usage flags:

  • --maxage 90 will sync messages up to 90 days old

Notes:

  • --noautomap is used to turn off the default auto-mapping of folders
  • --f1f2 "Deleted Items=Trash" is used to manually map individual folders when --noautomap is specifed
  • --folder "Deleted Items" must be used with --noautomap to specify which folders to sync
  • --folderrec "Folder Name" will recursively sync folder (vs. using just --folder)
Webmentions & Comments

Copyright © Paramdeo Singh. Built with Jekyll and ☕️ in Guyana. All Rights Reserved.

Last Site Build on Mon, 02 Aug 2021 12:05:40 -0400

1MB Club Badge

Paramdeo Singh Guyana

Riding the wave of consciousness in this treacherous mortal sea.

Technology Design Strategy Literature Personal Blogs