Using mutt with Gmail I "check for e-mail updates" sometimes through the $ binding (sync-mailbox), sometimes just by using c (change folder) and just supplying = (defaults to MAILBOX) as the IMAP folder path to change to.

Is there a better (in particular: faster) way of doing the same? A solution would be something that is more direct than "pretending to switch folders", as I do, for example. Also something that does not "miss" some updates, as $ seems to do at times (perhaps $ is not meant to check for e-mails at all but just to expunge messages marked as deleted, etc?)

  • Why aren't you just using the mail_check settings in mutt? – jasonwryan Oct 5 '12 at 3:22
  • 2
    To be able to choose when I poll the server? – Robottinosino Oct 5 '12 at 3:25
  • man muttrc | less -p mail_check - configure if/when mutt looks for new mail... – jasonwryan Oct 5 '12 at 3:26
  • 1
    mutt updates the folder status after every keyboard input; either keep hitting $ or bind a specific key of your choice... Personally, I'm happy with letting mutt handle it. – jasonwryan Oct 5 '12 at 3:40
  • 1
    Really? keep hitting $? – Robottinosino Oct 5 '12 at 3:44

Bind a key (G for "Get" is recommended) to imap-fetch-mail in your ~/.muttrc.

 bind index G imap-fetch-mail

Pressing G while in the index will now fetch new mail from the imap server.

(for POP users, the fetch-mail function fetches mail from a POP server)

  • 1
    Looks great... could I run this as a simple command, without the binding? How? (thanks a lot for your answer, BTW) – Robottinosino Oct 5 '12 at 4:12
  • sorry, i don't understand the question. what do you mean by "run this as a simple command"? – cas Oct 6 '12 at 2:38
  • 1
    @Robottinosino You can run the command without binding it to a key with M-x (i.e. Alt+X or ESC x): M-x imap-fetch-mail RET. – Gilles 'SO- stop being evil' Oct 6 '12 at 21:11
  • 3
    Both Meta_L+x and Alt_L+x give me: Key is not bound. Press '?' for help. – Robottinosino Oct 7 '12 at 2:01
  • 4
    To do it unbound, just type :exec imap-fetch-mail. But that won’t refresh anything when mutt thinks it’s in sync with the server but really is not (this seems to happen if you use another client to edit the mailbox and after editing the count of messages in the mailbox has not changed (e.g., delete+receive new mail)). – binki Jan 2 '17 at 0:53

You can set the timeout variable to something like:

set timeout=10

This will poll the current mailbox every 10 seconds at most when mutt is idle waiting for user input, more often than the default 600 seconds. This is not needed in post v1.5.11 when IDLE is enabled.

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.