I am using Mutt 1.5.20 in Mac OS X Terminal. I have a Google mail account whose mail I fetch via IMAP. I also use a Gmail notifier app to notify me of new e-mail messages. My experience with Mutt dates no later than 1 week.

The trouble is this: When my Gmail notifier tells me about a new e-mail, I hit the Terminal to open Mutt. I can read the message and Mutt will mark it as read. However, Google's servers are not told that the message is read until Mutt is closed. Thus, my Gmail notifier continues to show a misleading unread count.

How can I force Mutt to synchronize with IMAP without having to quit every time I finish reading my e-mail? Preferably the sync will occur instantaneously, but a periodic sync would be satisfactory as well.

migrated from stackoverflow.com May 20 '11 at 13:54

This question came from our site for professional and enthusiast programmers.


Manual syncing

Try $:

$         sync-mailbox         save changes to mailbox

Automatic syncing?

You can't make mutt do that automatically/periodically, by design. The reasoning, as I understand it, is that it might lead to data loss. E.g., when you mark something as deleted, you'd normally be able to undo, and auto-syncing would interfere with that (see Re: Auto sync-mailbox - no way! and Mutt, IMAP and auto'refresh').

Mailboxes should be synced in any case when you change folders/mailboxes.


There's a source patch adding a timeout-hook to mutt you could use to periodically call sync-mailbox, but it's for mutt 1.5.9 and I don't know if it can be applied against the current version.

You could also set up OfflineIMAP (or isync). It's designed for synchronizing local mailbox(es) with a central IMAP one. You can then use another notification system (like e.g. mutt's built-in one or mail-notification etc.) to watch your local box for changes.

  • This is good. Shamefully I hadn't noticed this before. However, the question now is: How can mutt be taught to do this periodically? – Sergey Jun 9 '11 at 4:13
  • 3
    Another alternative approach is to simply add <sync-mailbox> to any macros you use frequently, like changing folders or viewing messages or something. – Aaron Massey Mar 4 '16 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.