Created
April 18, 2016 20:22
-
-
Save benmaughan/9d99d3810f5edf682a92ceb347119386 to your computer and use it in GitHub Desktop.
Count number of emails in inbox, drafts and outbox for mail indexed with mu and sent with sendmail or equivalent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
########################################################################### | |
# | |
# Count number of emails in inbox, drafts and outbox for mail indexed | |
# with mu and sent with sendmail or equivalent | |
# | |
# by Ben Maughan | |
# http://www.pragmaticemacs.com | |
# | |
# Feel free to distribute, modify, whatever | |
# | |
########################################################################### | |
## total mails in inbox | |
chomp(my @tot=`/opt/local/bin/mu find maildir:/INBOX`); | |
## unread mails in inbox | |
chomp(my @unread=`/opt/local/bin/mu find maildir:/INBOX AND flag:unread`); | |
## drafts (implies delayed if using mu4e-delay) | |
chomp(my @drafts=`/opt/local/bin/mu find maildir:/[Gmail].Drafts`); | |
## number in outbox | |
chomp(my @mailq=`/usr/bin/mailq`); | |
my @outbox = grep /^[0-9A-F]{12}/, @mailq; | |
printf "@ %d/%d/%d/%d",$#unread+1,$#tot+1,$#drafts+1,$#outbox+1; | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment