6.7 KiB
6.7 KiB
azos/mail
Architecture
- 3 accounts defined in
features/mail/default.nix:zakobar(primary, aner@zakobar.com via privateemail.com IMAP/SMTP),gmail(anerisgreat@gmail.com),bgu(anerz@post.bgu.ac.il, gmail-flavor IMAP) - Sync stack:
mbsync(isync) pulls IMAP →~/Maildir,msmtpsends,muindexes for search/mu4e. Confirmed by live inspection (2026-10-08): generated~/.config/isyncrcand~/.config/msmtp/configare fully populated and actively syncing (recent.mbsyncstatetimestamps); mu4e'smu4e-get-mail-commandis literallymbsync -a. - lieer was declared (
services.lieer.enable=/=programs.lieer.enable) but had zero real footprint (no.gmailieer.jsonanywhere, no systemd units) — vestigial, removed fromfeatures/mail/default.nix. - Credentials via
pass:mbsync/anerisgreat@gmail.com,mbsync/anerz@post.bgu.ac.il,privateemail.com(zakobar account). All decrypt through the same GPG smartcard (yubikey) key. - Periodic sync:
systemd.user.timers.mbsync-timerruns every 5 min (2 min after login, then everyOnUnitActiveSec). Guarded by agpg --card-statuspresence check in thembsyncSafewrapper script so a missing yubikey skips the sync silently instead of triggering a pinentry "insert card" prompt —gpg --card-statusonly queries the reader and never itself invokes pinentry, making it a safe non-interactive gate. - Mail client is mu4e in Emacs (
azos-core/features/station/emacs/config.org), not notmuch (anotmuch-hellomode reference exists only in a linum-disable list, appears vestigial/unused)
Conventions
- mu4e contexts match by maildir prefix:
/zakobar,/gmail,/bgu; each sets its own sent/drafts/trash/archive (archive = "All Mail" for gmail-flavor accounts) - No user-defined tagging system — "tags" in this setup means mu4e flags (unread/trashed/replied) and Gmail labels, which arrive as IMAP folders under
[Gmail]/rather than mu4e-native tags - Bookmarks (saved searches) defined in config: Inbox (all 3 combined), Unread, Today, Week
- Maildir shortcuts:
z=/=g=/=bkeys jump to each account's inbox - Mail opens in a dedicated singleton tab via
azos/mail/open(bound under the "open" keymap)
Gotchas
- mbsync's
remove=/=expungehome-manager options (per-accountmbsync.remove=/=mbsync.expunge) default to"none"and were never set —\Deletedflags synced down from IMAP but never actually got removed/expunged on either side, so trashed messages lingered forever in the local Maildir and showed up (struck-through) in any mu4e bookmark that didn't explicitly filterflag:trashed. Fixed 2026-10-08 by settingmbsync.remove = "both"=/=mbsync.expunge = "both"infeatures/mail/default.nixdefault_account_params, for all 3 accounts. Caveat: for Gmail-flavor accounts (gmail=/=bgu), Gmail's IMAP quirk means expunging any folder other than[Gmail]/Trashjust removes that one label — the message survives under other labels (e.g. All Mail).zakobar(plain IMAP, no label system) has no such safety net: expunge there is a real, permanent, unrecoverable delete. - BGU's Workspace account (
anerz@post.bgu.ac.il) localizes/renames the Gmail "Trash" special-use label to[Gmail]/Bininstead of[Gmail]/Trash— caused mbsync error "channel bgu: far side box [Gmail]/Trash cannot be opened" plus a stale local[Gmail]/Trashmaildir with orphaned messages.mu4e-trash-folderfor the BGU context must be/bgu/[Gmail]/Bin. Fixed 2026-10-08 (merged stale local messages into Bin, updated context). Don't assume standard Gmail folder names for Workspace/edu accounts — verify via IMAP LIST per account. - mu4e's "Inbox" bookmark historically did NOT exclude
flag:trashed(unlike Unread/Today/Week) — direct cause of visibly crossed-out mail in Inbox.flag:trashedonly reflects the literal MaildirTflag; it does NOT mean "located in a Trash/Bin/Spam-named folder." Because of Gmail's multi-label model, a genuinely-unread message filed anywhere also has a duplicate unread copy under[Gmail]/All Mail(same Message-ID, separate local file) — this inflated Unread-bookmark counts by ~2x. Fixed 2026-10-08: all four bookmarks (config.org,mu4e-bookmarks, ~line 95) now share onelet-bound exclusion string filteringflag:trashedplus the Trash/Bin/Spam/All-Mail/"Deleted Messages" maildirs per account. - Live Emacs session state and the on-disk literate config drift independently: a nix rebuild (
azos-lauretta-update) only regenerates files on disk, it does NOT reload anything into an already-running Emacs —mu4e-contexts=/=mu4e-bookmarksetc. stay at whatever was lastload-file'd or evaluated at startup. After editingconfig.org, hot-reload the specific top-level form that changed viaemacsclient -e '(load-file "/tmp/x.el")'(extract just that sexp with exact matching parens — off-by-one line ranges silently truncate the form and error "End of file during parsing"). Forgetting to reloadmu4e-contextsafter fixingmu4e-trash-folderbriefly almost recreated the just-deleted stale/bgu/[Gmail]/Trashfolder, because the live session's BGU context still pointed at the old path and mu4e prompted "create trash folder?" on trash-mark-apply. - Debugging mu4e live via
emacsclient -e:(with-current-buffer "*mu4e-headers*" mu4e--search-last-query)shows the active search;(gethash docid mu4e--mark-map)on a buffer's message-at-point shows the exact pending mark+target before applying;(mu4e-context-vars (mu4e-context-current))shows live (not file) context vars. Caution: if Emacs is blocked on a blocking minibuffer prompt (e.g. ay-or-n-p"create folder?" confirmation), queuedemacsclient -ecalls will hang/timeout rather than error — that's a sign a prompt is open and needs a human to answer it, not a crash. - BGU mailing list
cs_msc@mlists.cs.bgu.ac.il(List-Id:cs_msc.mlists.cs.bgu.ac.il) floods/bgu/logistics-cs-mscwith announcement mail that's essentially never read (backlog since Jan 2024, ~330 messages). Intended fix is a Gmail filter in the BGU Workspace webclient (Settings → Filters and Blocked Addresses, matchinglist:cs_msc.mlists.cs.bgu.ac.il, action "mark as read", optionally applied retroactively to existing matches) — not a local/mu4e-side fix, since it's about delivery-time read-state for mail the user doesn't want to individually triage.
Key Files
features/mail/default.nix— accounts, mbsync/msmtp/mu config, mu init activation script, mbsync-timer systemd service/timerazos-core/features/station/emacs/config.org(search "mu4e") — mu4e contexts, bookmarks, shortcuts, signing blacklist logicazos-core/features/station/emacs/_pkg.nix— mu4e package dependency