gauteh / lieer

Fast email-fetching and sending and two-way tag synchronization between notmuch and GMail
http://lieer.gaute.vetsj.com
Other
494 stars 60 forks source link

Cannot import mail with inbox tag unaltered #277

Open rhstanton opened 1 month ago

rhstanton commented 1 month ago

I want to import emails without changing the tags on gmail at all. In particular, if an email is in Inbox on gmail, I want it tagged inbox on my local system, and if it is not in Inbox on gmail, i want it not to be tagged inbox on my local machine. But I can't get this to happen. Regardless of what I do, every email that gets imported seems to have both inbox and unread tags set.

I know this is the default action if you don't specify something explicit for new.tags. I've also seen another thread here talking about how configuring new.tags in .notmuch-config may not work, and suggesting that you instead need to set this option using

notmuch config set --database new.tags ...

Unfortunately, no matter what I do, I get the same behavior with every imported email having inbox and unread tags set.

To test this, I've set up a new gmail account that has just three messages in total. Two are in Inbox. Of these, one also has another label(as well as Inbox) attached. Finally, there is one last message that is not in Inbox and has another label attached. One of the messages in Inbox is unread, while the the two messages are read.

When I do my first sync using gmi and then run

notmuch search tag:inbox

it shows three messages (instead of the correct 2), as does

notmuch search tag:inbox

(instead of the correct 1)

Here are some experiments I've tried:

1) Comment out tags= line.

Running notmuch config --get new.tags returns unread and inbox, the expected default settings. I didn't bother to actually import anything here.

2) tags= in .notmuch-config (i.e., blank after the =)

Running notmuch config --get new.tags returns nothing. This looks hopeful!

But after running gmi init and gmi sync on a freshly prepared directory,

notmuch search tag:inbox shows 3 messages (not 2) notmuch search tag:unread shows 3 messages (not 1)

3) Comment out tags= line and run notmuch config set --database new.tags

Now notmuch config --get new.tags returns unread and inbox, and when I import notmuch reports three unread messages and three messages in Inbox

4) Uncomment tags= and run notmuch config set --database new.tags

Now notmuch config --get new.tags returns nothing, but when I import notmuch again reports three unread messages and three messages in Inbox.

I'm not sure what to try next, but it seems that getting notmuch to report that it's not assigning any tags is not the same things as notmuch not actually assigning any tags...

Has anyone actually got this to work? Otherwise I love lieer. I spent a long time getting mbcync to work, but ended up with multiple copies of messages, which is clearly asking for trouble. Lieer is really easy to get to work and only imports each message once, which is a really good start! If only I could get the tags to work properly...

By the way, I'm running notmuch 0.38.3 under macOS (installed via Homebrew) and I installed lieer from the Github repository yesterday.

Thanks for any suggestions.

gauteh commented 1 month ago

Hi, maybe this is related to https://github.com/gauteh/lieer/issues/229 ?

rhstanton commented 1 month ago

Yes, it's the same thing, I think. And I can verify that things work if I revert to lieer version 1.3, as suggested by tabuchid

gauteh commented 1 month ago

I believe there was another work around where you can use the newer notmuch bindings as well. You might have to set the new-tags using notmuch config as well.

gauteh commented 1 month ago

Ah, I see you have tried most of that..

rhstanton commented 1 month ago

Yes, I think the real new content of my message was that even when config get tells you no tags are being added, it's not necessarily telling you the truth. I couldn't find a combination of config file and command line configuration that would not add inbox and unread.