On 17:49 16 Jan 2002, Michael Montagne <[EMAIL PROTECTED]> wrote:
| > On Thu, 17 Jan 2002, Cameron Simpson wrote:
| > >Well, this isn't strictly an "in mutt" solution, but I don't use
| > >$mailboxes to monitor email. Instead my procmail recipe runs a small
| > >shell script when delivering to particular folders, and that script
| > >writes a line to a file I'm monitoring in a small always-open xterm
| > >citing folder, author and subject.
| >
| > I wouldn't mind taking a look at both the script and the recipe, if you
| > don't mind. I've been wondering how to do that.
|
| Me too, that sounds very interesting. Can you share it to the list?
Well, bear in mind you did ask this of someone with a heavily customised
environment.
Also note that I automgenerate my .procmailrc with this tool:
http://freshmeat.net/projects/cats2procmailrc/
so the apprently painful verbosity is done by a program from this single line:
!attn CSKK [EMAIL PROTECTED]
The "!" means "make an alert line, "attn" is the folder, "CSKK" is a tagline
and "[EMAIL PROTECTED]" is a target email address to match on.
So on to the example procmail recipe:
: 0
* ^(to|cc|bcc):.*cskk@optushome\.com\.au
{
: 0hc
| mhdrs | { while read hdr body; do eval "HDR_$hdr=\$body"; done; alert -c
yellow "`timecode` +attn $HDR_FROM; $HDR_SUBJECT"; }
: 0hf
| sed -e 's/^Subject: *\[[^ ]*\] */Subject: /' -e 's/^Subject: *[Rr][Ee] *:
*\[[^ ]*\] */Subject: Re: /' -e 's/^Subject:/& [CSKK]/'
: 0
attn/.
}
Now, note that only the first bit matters. This recipe does three things
on detection of email for [EMAIL PROTECTED]:
- generates an alert for my window
- hacks the subject line to mark it with [CSKK] and tidy it up a bit
- drops it in my +attn folder when my high priority email goes
So the core trick is to use the {...} stuff to do a few things in a
given recipe, and thus to have an alert action for specific rules.
That said, mhdrs is a tiny perl script to crudely grab header lines from
the mail message (supplied on stdin by procmail):
http://www.zip.com.au/~cs/scripts/mhdrs
and write them out in shell friendly form. The while loop sucks them up
and makes variables like $HDR_SUBJECT etc for use by the alert command,
which is just a script:
http://www.zip.com.au/~cs/scripts/alert
to deposit the supplied line onto the logfile, in yellow in this instance.
Then my FvwmButtons at the screen top has a 3 line transparent rxvt
which runs "tail -f" on the logfile.
And lo, when such email arrives it's mentioned quietly but obviously at
the top of my screen.
--
Cameron Simpson, DoD#743 [EMAIL PROTECTED] http://www.zip.com.au/~cs/
I'm beginning to like them llamas more and more... - Curtis Jackson