procmail
[Top] [All Lists]

Forwarding and saving to file

2001-02-08 08:33:54
Dear all,

Long time no see, I've been unsubscribed for a while, I must admit, but
when I run into trouble, I come crawling back. :-)

I'm setting up a network to allow Norwegian amateur astronomers to
participate in search for optical counterparts of Gamma Ray Bursts, I'm
setting up pages at <URL:http://www.astro.uio.no/ita/grb/alarm/>
(Norwegian only) for the purpose.

Now the story is that I get (for now) e-mail from the Gamma Ray Burst
Coordinates Network (GCN), and upon reception of these e-mails, certain
strings should make the body of the e-mail be saved to a file (I've got a
Perl daemon looking for that file), and if this string isn't present, the
e-mail should be forwarded to a mailing list, pretty much as it is.

I've made the following code, which I INCLUDERC:
# The strings that means alert:
GRBALERT="IPN Single Box"

:0
* ^From:(_dot_)*vxw(_at_)capella(_dot_)gsfc(_dot_)nasa(_dot_)gov
* $!^X-Loop: $MY_ADDR
{
        :0 Bw:
        * $ $GRBALERT
        | $FORMAIL -I "" > /mn/alnair/u1/kjetikj/tmp/grbalert.txt

        :0 w
        | $FORMAIL -k -X "From:" -X "Subject:" -X "Received:" \
                -I "Reply-To: nas-gamma(_at_)astro(_dot_)uio(_dot_)no" -X 
"Reply-To:" \
                -I "To: nas-gamma(_at_)astro(_dot_)uio(_dot_)no" -X "To:" \
                -I "X-Loop: $MY_ADDR" -X "X-Loop:" \
                -I "Resent-From: $MY_ADDR" -X "Resent-From:" \
          | $SENDMAIL $SENDMAILFLAGS -t
}

$GRBALERT is the string I'm looking for (to be extended once I hear what
the new HETE-2 satelite will be saying), $MY_ADDR is my own address, set
elsewhere, $FORMAIL is set appropriately.

Does this make sense? I attempted a dry run on .procmailrc, I fed it a
file of nine messages, where one was an old alert that should match
$GRBALERT, it didn't look too good, all nine messages ended up in my
inbox... Also, Jari's Emacs lint says that I might like to have a f flag
on the last recipe, I can't say I understand why, but I guess it may be
for good reason...

In the second part, I'd like to preserve the Received-headers, just in
case anybody likes to check how long the message has been in the network
(for small telescopes, time is of the essense, but haveing them there is
not _that_ critical, really), and I'd like to set the Reply-To-back to
the list. Since I will myself be on this list, it is critical that it
doesn't trigger on e-mail allready been through the list, and this is
also the reason why I don't keep a copy for myself. The Resent-From-stuff
I insert just for the courtesy of letting people know it's been through
me.

Best,

Kjetil
-- 
Kjetil Kjernsmo
Graduate astronomy-student                    Problems worthy of attack
University of Oslo, Norway            Prove their worth by hitting back
E-mail: kjetikj(_at_)astro(_dot_)uio(_dot_)no                                - 
Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster(_at_)skepsis(_dot_)no

_______________________________________________
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>
  • Forwarding and saving to file, Kjetil Kjernsmo <=