Skip to content

feat(mailmover): add per-account folder priorities and auto-rename - #386

Open
fishman wants to merge 1 commit into
afewmail:masterfrom
fishman:feat/per-account-folder-priorities
Open

feat(mailmover): add per-account folder priorities and auto-rename#386
fishman wants to merge 1 commit into
afewmail:masterfrom
fishman:feat/per-account-folder-priorities

Conversation

@fishman

@fishman fishman commented Aug 10, 2026

Copy link
Copy Markdown

This PR makes move mode work across accounts with different folder layouts: a new folder_priorities option resolves rule destinations per account (first existing candidate wins, globs supported). It also adds rename=auto, which renames only mbsync files(instead of manually specifying it), keeps wildcard folder rules limited to managed folders, skips no-op same-folder moves and stale index entries, and reopens the notmuch database between folders to avoid stale-revision errors.

  • rename = true | false | auto
    true renames every moved file (fresh UUID, flags kept). false keeps original names. auto renames only files that already carry an mbsync UID (,U=NNN in the name), so mixed mbsync/offlineimap setups keep UIDs only where needed.

  • folder_priorities = tag:folder1,folder2,...;...
    Maps a tag to an ordered list of candidate folders. When a rule destination equals a priority key, it is resolved per account: the first existing candidate wins (* candidates are globs), else the first candidate is used as fallback. This lets one rules block target [Gmail]/Spam for gmail but Spam for other accounts.

  • Wildcard folder keys (folders = gmail/* fishman/*)
    A key ending in /* expands to the account's INBOX plus all resolved priority folders that exist on disk. Organizational subfolders are never expanded or moved from.

Rule destinations can now resolve to priority folders per account;
wildcard folder rules expand to managed folders only. `rename=auto`
renames only mbsync files; same-folder moves are skipped.
@fishman

fishman commented Aug 10, 2026

Copy link
Copy Markdown
Author

Ideally rename=auto should become default once proven, it took me a lot of mistakes and a few lost mails, before I noticed the setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant