How do I program Mutt to decide when a new letter arrives?
There is an option in the Mutt config variables
that causes Mutt to beep when a new email arrives. There is also a command
that executes a command in the inner shell. Is there a way to make Mutt perform some user-defined action (shell command) when a new email arrives? Maybe it
can help? (Can be used
in a config file to invoke a shell command. Is there a way to do this when starting Mutt?)
EDIT: As per Glenn's advice, the script from Mutt can be called by setting up a custom state format in the .muttrc file:
set status_format="/some/script.sh '%r %f (%L) |"
But I can't figure out how to use this to detect new emails, since the command line shows the message "New mail in ..." rather than the status bar. And if the letter arrives in a mailbox that is not the current one, then the status bar does not change at all.
EDIT 2: OK, the% b variable in status_format did it.
source to share