Newmail is a command-line application that lets users check for unread mail in Maildir folder structures. It's a utility that makes it simple to scan for new mail recursively.
By calling newmail without any command-line arguments, users can get a quick overview of which folders contain unread mail. The example code for this functionality is as follows:
$ newmail
2 [ INBOX ]
11 /lists/bugtraq
2 /lists/netbsd-current
4 /lists/pkgsrc-cvs
To determine the total number of emails, users can invoke the following code:
$ newmail -at 56170
To find out the top ten folders, excluding spam and trash, users can call the following example code:
$ newmail -a | grep -vi 'spam|trash' | sort -nr | head
11260 /lists/info
4287 /lists/bugtraq
1557 [ INBOX ]
1062 /lists/pkgsrc-cvs
955 /bank
719 /burningsoda/svn
569 /lists/bsd
388 /studium
312 /lists/communities
306 /lists/info_kbx
To make the browser in mutt switch between showing all folders and only folders containing new mail when pressing 'a' and 'n' respectively, users can add the following three lines to their .muttrc file:
mailboxes `newmail`
macro browser a ":unmailboxes *< enter >:mailboxes `newmail -am`< enter >< check-new >" "show all mailboxes"
macro browser n ":mailboxes *< enter >:mailboxes `newmail -m`< enter >< check-new >" "show only mailboxes containing new mail"
The following options are available when using newmail:
-a, --all: Count the total number of mails for folders in DIRECTORY.
-m, --mutt: Output folder names in a mutt-friendly way, allowing newmail to be used by the mailboxes command in mutt.
-n, --no-unseen: Do not treat unseen mails as new to speed up newmail, especially on slow file systems. This option should only be used if no other process watches the structure and moves mails out of the new/ directory of the mail folders.
-t, --total: Sum up the total number of mails and display only the final number. This option has no effect if --all is specified.
Version 1.0: N/A