I use mutt with offlineimap so this might not apply to you but for the offlineimap case you just have to check the files in $MAILDIR/account/INBOX/new
, e.g.
maildirs="$HOME/.mail/*/INBOX/new/"
numofnewmail="$(find $maildirs -type f | wc -l)"
xsetroot -name "mail: $numofnewmail, $date"
where $MAILDIR
is usually ~/.mail
. Also, depend on your mail account and your configuration also the name of the inbox folder can vary (e.g. Inbox
instead of INBOX
).
Also, you didn't ask for it, but here's a wizard that can help you setup mutt with offlineimap.