Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintaining a folder/tag parity #313

Open
ploum opened this issue Oct 11, 2021 · 3 comments
Open

Maintaining a folder/tag parity #313

ploum opened this issue Oct 11, 2021 · 3 comments

Comments

@ploum
Copy link

ploum commented Oct 11, 2021

As I still also access mail through my webmail, I’m trying to configure notmuch/afew in order to maintain a tag/folder parity.

-> If a mail is moved in a folder on the webmail, it should have the old folder tag removed and a the new folder tag added in notmuch.

-> If a mail is taggued with "archive", it should be moved to the archive folder (yes, my folders are really simples : inbox, sent and archives).

I thought that, with afew, this would be quite easy to implement. But, after spending several days on it, I still don’t make a lot of progress. I’ve settled so far with only one FolderNameFilter to make debugging easy.

If a folder is seen as "inbox" by notmuch then archived on the webmail, it will keep its inbox tag forever. (same happen for any folder)

Is there a way to achieve that with afew?

I’ve the feeling that this might be a common usecase and thus should be advertised more clearly in the documentation

@benmezger
Copy link

@ploum I believe you might need a few more steps. I solved this with Gmail by using the following approach:

  1. run afew with -m flag before running mbsync
  2. Run mbsync, then tag all your email
  3. Run afew with the -m flag again, and ideally, before that, tag all your emails again.

See: https://github.com/benmezger/dotfiles/blob/main/dot_config/afew/config

Ideally, you need to filter for the folder instead. If the email is in the deleted folder, for example, remove all other tags and keep the +deleted flag.

@GuillaumeSeren
Copy link
Collaborator

Hey,
sorry to be late.

I do the same, so yes it can be done, it is not synchronous so new mails are not tagged / sorted etc,
but it is good to have the imap storage to be close that the notmuch state.

Before each sync I use the MailMover to move the according to some rules like:

# Perso
Perso/INBOX = 'tag:spam':Perso/spam 'tag:sent':Perso/sent 'not tag:inbox':Perso/archive 'tag:trash':Perso/trash
Perso/archive = 'tag:inbox':Perso/INBOX 'tag:spam':Perso/spam 'tag:sent':Perso/sent 'tag:trash':Perso/trash
Perso/spam = 'NOT tag:spam':Perso/INBOX 'tag:sent':Perso/sent 'tag:trash':Perso/trash
Perso/sent = 'NOT tag:sent':Perso/INBOX 'tag:spam':Perso/spam 'tag:trash':Perso/trash
Perso/trash = 'tag:inbox':Perso/INBOX 'tag:spam and not tag:trash':Perso/spam 'tag:sent and not tag:trash':Perso/sent

@agenbite
Copy link

agenbite commented Dec 7, 2021

As I said in #317 for those of us that do have an intricate folder tree, it'd be nice to have an afew solution which does not involve listing all the folders. Thanks for contributing, though.

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

No branches or pull requests

4 participants