procmail
[Top] [All Lists]

Re: Need assistance with mail forwding mail

1997-05-07 09:50:00
On Wed, 7 May 1997 08:35:17 -0700 (PDT), savitt(_at_)netcom(_dot_)com 
(David Savitt) wrote:
I would like to restrict the hours that mail would be forwarded to
the pager, say to between 9am and 10pm.  This is so that the pager

The From_ line contains a time stamp, match on that. 

people include some of my message in theirs that is preceded with
a ">".  What I would like is to not send the ">" lines and jump
to the first part of the message as my 200 characters.  Make sense?

sed -e '/[      ]*>/d'

As for how to get the first 200 characters only, I recall seeing a
spiffy solution some while ago, but you could simply feed the whole
body (quoted parts and all) to a Perl script and let that do the hard
work. (It's not so hard then. :-)

    FROMSUBJ=`formail -xFrom: -xSubject:`

    :0cb
    * ^From [^ ]*  ... ... .. (09|1[0-9]|2[0-1]):
    * ! ^FROM_DAEMON
    * ... any other conditions you might want here
    | perl -ne 'next if m/[\t ]*>/; ' \
            -e '$i += length; last if ($i > 200);'
            -e 'print' | fastmail -s "$FROMSUBJ" - pager(_at_)address

(fastmail comes with elm, use something else if you don't have that.)

Perhaps there is a better way (using some AI program) to have the
message summed up in a few lines.  If so, I am open to suggestions,

Good luck with that idea ;-)

Hope this helps,

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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