procmail
[Top] [All Lists]

send mail to terminal

2003-03-29 02:23:52
:0fw
 | formail -k -x X-Mailbox: -X From: -X Subject: |egrep -v 
'\s+>|Content-|boundry|^--' |\
 perl -ne 'if (not /(From: "?Eric Smith"?|---.*(Oorspronkelijk bericht|original 
me ssage|nachrigt).*---)/i../eof/)\
{print "+- $_";last if $i++==24}'| write eric /dev/pts/7
:0f
 | screen -X -S inner eval 'focus top' 'focus down' 'select 5'

This is what the process looks like now - (it will evolve some more no doubt).

First it grabs only the main headers. Then it tries to remove a (m$) quoted 
message below the body
and prints only the first 24 lines of whatever results.

It then uses write(1) to send the output to a virtual terminal.  The next 
command calls
screen and changes the lower screen to the one where the mail is written.

Saves me fumbling around with MUAs a lot of the time.

According to Tyler F. Creelan on Fri, Mar 28, 2003 at 09:36:58PM -0800:
On Mar 24 at 11:07pm +0100, Eric Smith wrote:

| The wait command dont seem to work for me.  I have the following series
| of rules and commands:
| :0c
| | formail -X From:>> $MAIL_TAIL
| :0c
| | formail -X Subject:>> $MAIL_TAIL
| :0c
| | formail -I ""|egrep -v '>|^Content-|^--' |sed '/^$/d'|perl -ne 'if (not 
/(From: Eric Smith |---.*original message|nachrigt.*---)/i../eof/){prin
| t "...  $_"} '|head -24 >> $MAIL_TAIL
| :0c
| | echo -e "\n................  mail divider .................\n">> 
$MAIL_TAIL
|
| This is ugly and I am sure I will be told how to write it better.

This looks interesting, however it isn't clear to me what you're
trying to do - generate an abstract of the message for a log or
biff-like announcement? Is MAIL_TAIL a file - if so don't you need
lockfiles for it? Don't you need global lockfiles around the whole
expression, to guarantee each entry in MAIL_TAIL refers to just one
message?

| What does it do -> this:
|
| <quote>
| tail: /home/eric/var_spool_mail.tail: file truncated
| From: Phil Pennock <phil(_dot_)pennock(_at_)globnix(_dot_)org>
|
| ................  mail divider .................
|
| Subject: Re: sending escape sequences to print in color
| ...  On 2003-03-24 at 22:00 +0100, Eric Smith wrote:
| ...  Portably: with difficulty.
| ...  If you restrict yourself to most modern terminals or terminal 
emulators,
| ...  then you're after the ANSI escapes, which are:
| ...  And here the number controls the colour, fg, bg, etc.  Use two digits,
| <...>
| </quote>
|
| Problem: the "mail divider" line gets executed either above the formail -X 
Subject:
| or above the body.  I tries the `f' flag and the `W' but do not get a 
result.
| How do I implement this more elegantly in procmail and get the "mail 
divider"
| to actually print between the mails.

None of the recipes enumerated above appear to be filtering recipes -
why would the "f" flag be useful? In terms of making the the last two
recipes sequential I think simply putting lockfiles on the recipes
would suffice, ie :0c: instead of :0, and you would need global
lockfiles around the whole expression.

| (PS: Will probably reimplement this to write(1) directly to a terminal 
rather than
| to a file - which I tail)

Okay, now I'm definitely confused...


Tyler

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

-- 
Eric Smith
Fruitcom BV
Tel: +31 15 750 2364
Fax: +31 15 750 2365
Mobile: +31 6 551 76300

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>