Mutt repeated new mail reporting problems
How mutt reports new mail
Unix systems usually store a last modified time and a last accessed time for each file in your file system. When a mail folder obtains new mail, its modified time becomes later than its accessed time. Mutt can notice this and report new mail. Then when you read the folder, the accessed time of the file containing the mail should become more recent than the modified time, so no new mail will be reported again until the next time mail is delivered.
A potential problem
If for some reason your system does not update the accessed time of files when you access them, the above process goes horribly wrong. Mutt will tell you again and again that you have new mail. Whenever you start mutt or swap folders it will claim you have new mail.
Some systems deliberately don’t update the accessed time, this happens if the
file system is mounted with the noatime
option and might give a small
performance boost. There might be something you can do about this, see man pages
for mount, chattr and lsattr.
If you can’t convince your system to update atimes automatically, either through lack of knowledge or permissions there are a few possible approaches. I wanted to avoid patching mutt. I also liked new mail announcements appearing within mutt itself so didn’t want to get another program to track new mail for me.
The yucky solution I used once
I found I could change access times using “touch -a”. I get mutt to do this automatically for me. Here is how I do this, but I’m sure there must be a better way. First put this line in your ~/.muttrc:
set wait_key = no
and then for each folder (eg called stuff) that mutt checks for new mail add a line like this:
folder-hook stuff push <shell-escape>touch<space>-a<space>~/mail/stuff<enter>
Update: just use maildir
If you use maildir instead of mbox format to store your mail the problem will also go away. Maildir has various other advantages too.