Files
dotfiles_arch/scripts/scripts/sync-all-mail.sh
2026-01-07 13:07:20 +01:00

20 lines
498 B
Bash
Executable File

#!/bin/bash
echo "=== Syncing all mailboxes ==="
# 1. Sync emails bidirectionally (includes deletions)
mbsync -a
# 2. Index each account separately (runs post-new hook)
for account in phil spam; do
echo "Indexing $account..."
NOTMUCH_CONFIG=~/Mail/$account/.notmuch-config notmuch new
done
# 3. Optional: Sync back any tag changes to IMAP flags
for account in phil spam; do
NOTMUCH_CONFIG=~/Mail/$account/.notmuch-config notmuch tag --batch < /dev/null
done
echo "=== Sync complete ==="