procmail
[Top] [All Lists]

Re: [procmail] no sorting suddenly

1999-04-29 13:04:52
[Original discussion posted on comp.mail.misc]

era eriksson <era(_at_)iki(_dot_)fi> writes:

 Didn't look too closely, but the thing that is most "wrong" is that
you didn't indicate whether there was any pertinent log activity (or
even whether you have tried looking in the log file). Other than that,
I'd say you need to say INCLUDERC=spam/spam.rc (or set MAILDIR as
appropriate). 

I had looked at .procmail.log, but wasn't sure what I was looking at.
I hoped laying out the setup and files would be enough.  As it is, you
caught the problem right off.  "INCLUDERC=spam/spam.rc"  was in my
original file but tinkering and overwriting  had removed it.

Thanks.   I will experiment with rcs/cvs sounds like a good way to
keep track of things.

On a slightly different subject:

In  spam.rc:
:0
{
        SPAM_LOG=${SPAM_LOG:-spam/spam.log}
        SPAM_SPOOL=${SPAM_SPOOL:-spam}
        FROM_ADDR=`formail -rtzxTo:`

        :0c
        $SPAM_SPOOL/.

        :0
        * ^To: *\/[^ ].*
        { TO_ADDR=$MATCH }

        :0
        * ^Subject: *\/[^ ].*
        { SUBJ=$MATCH }

        :0
        * ^Message\-ID: *\/[^ ].*
        { MSID=$MATCH }
# original seperators were (:) colons.  changed to ** [hp]
        :0h: $SPAM_LOG$LOCKEXT
        | (echo "`date` ** $FROM_ADDR ** $TO_ADDR ** $SUBJ ** $MSID" >> 
$SPAM_LOG)
}


I've added the last :0 section to get the message-ID into the log
file.  After looking over the other phrases and seeing how they work,
I was able to get the right syntax and it is logging the message ID.

(changed the ":" colon separators to "**" to make it easier to use awk
on this file.  ( the input itself contained numerous ":"'s. making
field seperation a problem)

I'm using "awk" commands to read this file in more presentable manner,
like each $VAR on its own line, Message-id only or subject only etc.
But I suspect I could arrange  spam.rc in such a way as to do that
without "awk"  if I knew more about the syntax involved.

One thing that clutters up spam.log is those jerky messages with
dozens of addresses in the "To:" field.  How might I limit the $To var
to the match only?

I'd also  like to get  each VAR  entry on a separate line.  Easily
done with awk but howso with the spam.rc file syntax? Tried adding
newline symbols like so:  $SUBJ\n  etc. but only succeeded in getting
the subject with "\n" (literally) after it.

Another thing that might be useful would  be to make the entries to
spam.log appear on the screen too.  I would get a quick look at what
went in the hole.

Being a newby with scripts and most other unix tools, I'm having
trouble catching on to the different syntaxs used in different programs.



<Prev in Thread] Current Thread [Next in Thread>
  • Re: [procmail] no sorting suddenly, Harry Putnam <=