procmailrc help

procmailrc help

am 19.04.2005 19:17:03 von tekion

all,
I am trying to filter this:
if subject contains msgs and Boby contains hda or Drive, then drop it
to my mail box and forward it to other user, and pipe it to script
which process the mail and do something with it. Here's what I have so
for:

:0
* < 256000
* ^Subject:.*msgs
{
SUBJECT=`formail -zx Subject:`
:0 ABfhw
* !^X-Loop: original-sender
* (hda|Drive)
| (formail -I "Subject: DiskError $SUBJECT" -A "X-Loop:
original-sender";)

:0 ABc
* (hda|Drive)
! user1@yahoo.com
}

I need to add the script to process the matched email, where would I
put that ( | external-script.pl; ). Thanks.

Re: procmailrc help

am 19.04.2005 20:31:13 von Alan Connor

On comp.mail.misc, in <1113931023.640142.241980@z14g2000cwz.googlegroups.com>, "tekion" wrote:




I have your answer, but am really curious about what you are
trying to do here.

Please explain carefully. Sending executables around by
auto-response is generally a bad idea.

AC

--
If you posted to me, and I didn't reply to your post, it is
because I didn't read it. If I didn't read it, I won't be reading
any responses to it. Nor will I be reading any other posts by
that alias, regardless of the subject, nor any responses to them.

Re: procmailrc help

am 19.04.2005 21:36:42 von tekion

Alan,
the perl script for now, will hack out Subject line as follow: type of
error , server name, then put it into a flat file (plan to use mysql
later). I want to keep track of new and old errors. I want to later
go back and check how many of these type of errors are occuring for
each server on the list. The reason I am pursuing this is to prove a
point, when disk errors occurs (just once) you should response to it.
When it occurs so often you should really look into it/replace the
drive if necessary.

Re: procmailrc help

am 19.04.2005 22:59:38 von Alan Connor

On comp.mail.misc, in
<1113931023.640142.241980@z14g2000cwz.googlegroups.com>, "tekion"
wrote:
> all, I am trying to filter this: if subject contains msgs and
> Boby contains hda or Drive, then drop it to my mail box and
> forward it to other user, and pipe it to script which process
> the mail and do something with it. Here's what I have so for:
>
>:0
> * < 256000
> * ^Subject:.*msgs
> {
> SUBJECT=`formail -zx Subject:`
> :0 ABfhw

That "A" is useless: There's no preceding recipe in the
current nesting level for it to relate to.

If you are thinking that is checking the * < 25....,
etc., I don't think so, and this would be a redundant
condition anyway, because anything that didn't match
that part of the recipe wouldn't make it into the
braces.

> * !^X-Loop: original-sender
> * (hda|Drive)
> | (formail -I "Subject: DiskError $SUBJECT" -A "X-Loop:\
original-sender") | external-script.pl

Note the above, the closed parentheses and the second pipe.

>
> :0 ABc
> * (hda|Drive)

You've already determined that that (hda|drive) are in
the body. Why do it again? Because of the "A" flag, it
wouldn't work unless the previous recipe's conditions
were met anyway.

> ! user1@yahoo.com
> }
>

Just:

:0 Ac
! user...


> I need to add the script to process the matched email, where
> would I put that ( | external-script.pl; ). Thanks.
>


From "tekion's" other post to me:

Alan,
the perl script for now, will hack out Subject line as
follow: type of error , server name, then put it into
a flat file (plan to use mysql later). I want to keep
track of new and old errors. I want to later go back
and check how many of these type of errors are occuring
for each server on the list. The reason I am pursuing
this is to prove a point, when disk errors occurs (just
once) you should response to it. When it occurs so
often you should really look into it/replace the drive
if necessary.

endquote.

Sounds interesting. Hope I've helped. Good job on the
procmail recipes.

AC


--
alanconnor AT earthlink DOT net
Use your real return address or I'll never know you
even tried to mail me. http://tinyurl.com/2t5kp