afewmail / afew

an initial tagging script for notmuch mail
ISC License
325 stars 97 forks source link

Multi-account MailMover #324

Open kirelagin opened 2 years ago

kirelagin commented 2 years ago

As a follow-up to #162, I am looking to setting up notmuch/afew with multiple accounts (within the same maildir), as in the referenced issue. FolderNameFilter works really well, as described there, however I am not satisfied with MailMover.

That’s more of a question rather than a specific proposal. In my case, I am using MailMover to sync tags back to directories (like, Junk and Archive), I imagine, similar to how many other people do this. So, what I’d like to have is an easy way to say that INBOX = 'tag:spam':Junk 'NOT tag:inbox':Archive etc. should apply per-account. IIUC, currently, my only option is to copy-paste each group of rules for each account.

Any ideas on how this can be improved? I mean, adding ad-hoc support specifically for this use-case to MailMover is probably pretty straightforward, but I am not sure whether this would be desired. Maybe there are some more general approaches.

GuillaumeSeren commented 2 years ago

Hey @kirelagin ,

So, what I’d like to have is an easy way to say that INBOX = 'tag:spam':Junk 'NOT tag:inbox':Archive etc. should apply per-account. IIUC, currently, my only option is to copy-paste each group of rules for each account.

Pretty-much yes, there is also a way to use disctinct config files but there is still duplication of the INBOX query, here is an example of what I use (I define a section like this per mail where the mover is working):

# Pro
Pro/INBOX = 'tag:spam':Pro/spam 'tag:sent':Pro/sent
Pro/archive = 'tag:':Pro/INBOX 'tag:spam':Pro/spam 'tag:sent':Pro/sent
Pro/spam = 'NOT tag:spam':Pro/INBOX 'tag:sent':Pro/sent
Pro/sent = 'NOT tag:sent':Pro/INBOX 'tag:spam':Pro/spam
mjg commented 2 years ago

Having to do this for each account for many folders is a bit annoying, yes. On the other hand: You have to do it once (for setup) only, and different accounts (mail providers) tend to have different defaults such as junk vs spam, upper or lower case, English or translated. In this case you have to do it separately anyways.

cmaiolino commented 1 month ago

I'm not sure if it fits here, but I've been trying to use different config files so I could use different email accounts. I'm not sure if solutions above would work as I'd also need different notmuch configurations for each account. Maybe being able to specify different config files to afew, is a good improvement?!