I’m bored, so here’s what my current .screenrc is (screenshot included).
backtick 1 60 60 /usr/local/bin/checkmail.pl hardstatus alwayslastline hardstatus string '%{= kW}%-Lw%{= KW}%50>%n%f* %t%{= kW}%+Lw%< %{= kG}%-=[Mail: %1`] %D %d %M %Y %c:%s%{-}' vbell off startup_message off
This is my .fetchmailrc
poll mail.techish.net with proto IMAP user me@example.com there with password xxxxxxxxx folder 'INBOX'
This is /usr/local/bin/checkmail.pl
#!/usr/bin/perl open FETCHMAIL, /usr/bin/fetchmail -t 10 -c -f ~/.fetchmailrc 2>/dev/null | or die Can't run fetchmail: $!n; while(<FETCHMAIL>){ if(/^(d+) messages ((d+) seen.*?folder (.*?))/){ $m+=$1; $s+=$2; $f=$3; # you might have to change this regex depending on # how your IMAP server displays subfolders $f =~ s/INBOX.//; } if($1 > $2){ $fs{$f} = $1 - $2; } } close FETCHMAIL; $t = $m - $s; if($t > 0){ foreach $folder (sort { $fs{$a}<=>$fs{$b} } keys %fs){ push @folders, $folder:$fs{$folder}; } } print join , @folders;