Skip to content

Imap sync tools

Isync

  • Website
  • Last release 2025-03
  • Arch wiki
  • Alternative to offlineimap
  • Example config: /usr/share/doc/isync/examples/mbsyncrc.sample

Usage

Sync all accounts:

mbsync -a

Only list mailboxes, don't sync:

mbsync -a -l

Remove folders

Remove Maildir folder client-side:

  • Remove all mail in the folder (mbsync does not delete non-empty folders to prevent accidents, which is good)
  • Sync: mbsync -a
  • Remove the cur directory in the folder
  • Sync again, this time with the -R flag: mbsync -a -R

Remove folder IMAP-side:

  • Remove folder with mail client
  • Sync with the -R flag: mbsync -a -R

Archive mail

From time to time, mail folders (like Archives/2021 i.e.) need to get locally archived to free IMAP quota.

Steps:

  • Remotely archive all mails of this year from all folders into the Archive/YEAR folder, including the ones from the Sent folder!
  • Then locally move the mail:
mbsync -a
mkdir -p ~/mail/Mail/archives/2021/cur
mv ~/mail/Mail/varac@varac.net/Archives/2021/cur/* ~/mail/Mail/archives/2021/cur
mbsync -a
  • Then remove the folder in the mail client, and also remove it from the Trash folder.
  • After this, remove the local folder with mbsync -a -R

pimalaya/neverest

Issues:

Offlineimap

Issues:

Offlineimap usage

Sync all:

offlineimap_concurrent.sh

Sync one account:

offlineimap -a varac.net -u blinkenlights

Delete a folder:

offlineimap -a varac.net --delete-folder Sent.2023
rm -rf ~/mail/varac.net/Sent/2023

Outdated tools