procmail
[Top] [All Lists]

Re: How to parse and resent info embeeded in an email

2001-07-25 08:01:46
* Don Hammond <procmail1(_at_)tradersdata(_dot_)com> [010725 10:27]:

Here's a possible start:

:0
* ^From: Errol Casey
* B ?? TODAY:[  ]*\>[   ]*\/High\>.*Low.*
{
   :0 fhw
   | formail -I "Subject: $MATCH"
   :0:
   $TESTDIR/ztestmbox   # $TESTDIR is *my* variable
}

Running your message through this filter delivered it exactly as sent
(headers and body), except:

$ diff testmsg ztestmbox 
48d47
< Subject: How to parse and resent info embeeded in an email
77a77
Subject: High 88F; Low 72F. Humid; breezy later.

Obviously, the first From: condition would need to be changed to
something suitable. This serves two purposes -- lessen the risk of
filtering the wrong messages, and preempt unnecessary body searches in
the next condition.  And the final action needs to be whatever suits
your needs. If you're intending to strip or otherwise munge the body,
or want to include the string "TODAY:", or want tomorrow's weather, etc.
there's more work left as an exercise.

[While doing this, Matt already got back with one. I offer this anyway
because it's pure procmail.]

It always helps to offer an alternative to whatever Matt produces.
Sometimes his solutions are a bit ... hasty  ;-)

-- 
- Matt Dunford <> zoot(_at_)zotikos(_dot_)com ..
-. www.zotikos.com -- o,;-
        
Dubya in his own words:
"It's important for us to explain to our nation that life is important. It's not
only life of babies, but it's life of children living in, you know, the dark
dungeons of the Internet."
   -Arlington Heights, Ill., Oct. 24, 2000
--
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail