procmail
[Top] [All Lists]

Efficiency and logging multiple lines

2002-07-22 06:16:54
Hi,

I'm trying to make my procmailrc more efficient by changing the
3 times I can formail down to 1 time. I use formail to grab
the From, Subject, and X-Spam-Status and stick it in possibly
3 different log files (using a formail each time). Instead of using:

        | formail -X From: -X Subject: -X X-Spam-Status: | \
                cat - ~/.procmail/separator >> $HOME/.procmail/junklog

I'm trying to use:

:0
ALLHEADERS=|formail -c -z -X From: -X Subject: -X X-Spam-Status:

:0
* ALLHEADERS ?? ^\/Subject: .*
{ SUBJECT=$MATCH }

:0
* ALLHEADERS ?? ^\/From: .*
{ FROM=$MATCH }

:0
* ALLHEADERS ?? ^\/X-Spam-Status: .*
{ SPAM=$MATCH }

Storing that for each message, and then logging by:

:0 c:maillog.lock
| echo $FROM "^M" $SUBJECT "^M" $SPAM "^M" "------" \
        >> $HOME/.procmail/maillog

But I can't seem to get the linefeeds or carriage returns to work right.
I believe my echo (FreeBSD) doesn't like the ^M (that's an embedded
carriage return) or even /n that some
shells do (I set SHELL=/bin/sh). Here is what I get in my maillog:

From: Mark Bynum <mark(_at_)mjbynum(_dot_)org>^MSubject: 
Testing^MX-Spam-Status: No, hits=-
99.1 required=5.0 tests=FROM_AND_TO_SAME,USER_IN_WHITELIST version=2.20^M------

Is there an easier, more efficient way to do this?

Thanks,

Mark
_______________________________________________
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>