Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?)

share|improve this question
Why aren't you just using the mail_check settings in mutt? – jasonwryan Oct 5 '12 at 3:22
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
But I would like to issue the command manually, only: more conveniently than "pretending to switch IMAP folders". Most of the time, I don't need the polling at all.. – Robottinosino Oct 5 '12 at 3:28
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
up vote 13 down vote accepted

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)

share|improve this answer
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
@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 Oct 6 '12 at 21:11
Both Meta_L+x and Alt_L+x give me: Key is not bound. Press '?' for help. – Robottinosino Oct 7 '12 at 2:01
Alright, I surrender to some sort of binding and will use: macro index,pager ,f "<imap-fetch-mail>" – Robottinosino Oct 7 '12 at 2:16

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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