0

I've currently got Neo/Mutt configured alongside iSync for a few different accounts. Everything syncs up and I've got the Mutt client configured roughly how I want it. However, I run into issues when using <save-message> to move a message to an Archive folder. It's different depending on the type of account:

  • In my two Gmail accounts, if I read a message and then <save-message> to my local "All Mail" folder, the message is moved as expected. Then, when I run mbsync, my All Mail folder in Mutt shows two copies of the same message, with one marked for deletion. They are also both marked as unread, even though I had read the message before moving it. My workaround has been to just delete messages from my inbox. On the following sync, the deleted messages appear in All Mail without duplicates (but still annoyingly marked as unread).

  • In my ProtonMail account, I can read and then save a message to my Archive folder. On the next sync, I have a duplicate message in the Archive folder, one marked as unread and the other as read, and neither is marked for deletion. Unlike in the Gmail accounts, deleting a message from my inbox does not result in the message showing up in my Archive, so that half-measure doesn't work here.

So maybe it's two separate issues but they certainly seem related. I've read multiple blog posts and scoured many dotfiles. I've seen "solutions" to the duplicate message problem such as folder hooks which delete duplicates when you enter the folder. These are not real solutions, IMO.

So I'm wondering if it's possible to tell Mutt to save a message to a remote folder, and if this would give better results. At the same time, I haven't configured Mutt for IMAP and would prefer that Mutt does no IMAP syncing, leaving that job to mbsync. I still want to use Mutt mainly to read mail that is stored locally, but I also want to teach it to move messages to remote IMAP folders.

Is this possible? Or is there a more obvious approach that I'm overlooking? In the meantime, I'm just manually marking archived messages as read, and deleting duplicates. If I could solve this problem, Mutt will be my favorite email reader by far.

1 Answer 1

1

I figured out how to get this working with the ProtonMail account. It turns out it is possible to save-message directly to an IMAP directory. However, while mbsync was interfacing with the ProtonMail Bridge's IMAP just fine, NeoMutt would get stuck on "Logging in..."

While trying to debug the overall issue, I had a look at mbsync's log. It didn't help me much to figure out why messages were getting duplicated, but I did notice it was using the LOGIN IMAP authentication method. So I added this line to my NeoMutt config:

set imap_authenticators = "login"

That, along with the following macro, allows me to move the current message or tagged messages directly to the IMAP Archive mailbox, and I no longer get duplicates:

macro index,pager A ":set confirmappend=no\n<tag-prefix><save-message>imap://127.0.0.1:1143/Archive\n:set confirmappend=yes\n"

There is still a small issue in that if the message is both marked as read and moved to Archive in the same mbsync run, the message will still appear as unread. I'm sure there must be some mbsync configuration I'm missing to solve this, but for now I will probably just change my macro to do something like this:

  1. Sync NeoMutt ($ by default), then run mbsync, ensuring the un/read states of all messages have been synced with IMAP.
  2. Then actually run save-message.
  3. Repeat step 1.

This will be a bit slow, but if I'm tagging a bunch of messages first then hopefully it won't be too bad. Good Enough For Now™.

Regarding Gmail, I've decided to just forward all my Gmail that hasn't yet been moved to ProtonMail and let the account die. I still have a Gmail work account, but it doesn't get nearly as much use. A similar approach may well work there, and if I get annoyed enough maybe I'll give it a shot and update this answer with whether it worked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .