procmail
[Top] [All Lists]

Re: Scanning imap mail

2009-11-15 18:32:40
On 13-Nov-2009, at 14:05, LuKreme wrote:
I use procmail to sort all my list mail into separate mailboxes, but since 
getting my iPhone it only scans for [the count of] unread messages in INBOX, 
so I'd like to create an email in my inbox that us something like:

Subject: 15 unread messages in 4 mailboxes
To: kremels(_at_)…

Procmail: 3 messages
Postfix: 11 messages
Foobar: 1 message

OK, I'm still mulling this over. The reason that I want to involve procmail is 
that the natural time to write this message is when a new message arrives, and 
since procmail already does a bunch of things when a new mail arrives, it seems 
a natural fit.

I guess, at its most basic, what I need is a tool that simply scans an IMAP 
directory for unread messages (it is not enough to just look at the new/ folder 
because messages are moved out of there as soon as they are 'seen' by one of my 
MUAs, and generally at least one of those is active all the time, even if on a 
machine I am not at).

It seems that there must be a fairly cheap<1> way to scan the IMAP tree for 
unread messages. I mean, at the most brute force something like

for i in `ls -a Maildir/ | grep -v '\.\.'` 
  do ls -1a Maildir/$i/{cur,new}/* 2>/dev/null | grep ",$"
done

Finds all the messages that are 'new'

<1> cheap as in processing time/scanning time.

-- 
He [Carrot] could lead armies, Angua thought. He really could. Some people have 
inspired whole countries to great deeds because of the power of their vision. 
And so could he. Not because he dreams about marching hordes, or world 
domination, or an empire of a thousand years. Just because he thinks that 
everyone's really decent underneath and would get along just fine if only they 
made an effort, and he believes that strongly it burns like a flame that is 
bigger than he is. --Men at Arms


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
<Prev in Thread] Current Thread [Next in Thread>