procmail
[Top] [All Lists]

Re: Can't get action | to work

2006-03-27 15:31:44
On Mon, Mar 27, 2006 at 04:34:10PM -0500, fleet(_at_)teachout(_dot_)org wrote:

I'm sure it's something I'm not doing; but I can't get the
following to work:

        :0
        * ^Return-Path:(_dot_)*(_at_)hotmail
           {
              :0
              * $ ^Subject:$WS\/.*$
              | (echo -e $TIME "bounce address" $MATCH "\n"` >> 
spamtest/spam.log)

              :0
              spamtest/gotcha
           }

What I *want* is to add the "echo" line to a file (spam.log),
then file the message in the "gotcha" folder.  The spamtest.log
shows:  Assigning "LASTFOLDER= (echo -e $TIME ... etc.


First, you have an errant backtick in the action line after
the "\n" that causes the action not to work at all.  So if you
are getting a spamtest.log file, then your recipe is different from
the one posted here.  You ought to be posting exactly what's in
the file you're having trouble with.

Second, your action line specifies the "log" (pseudo-log) should be 
"spamtest/spam.log"; yet you wrote above that you get a result in
something called "spamtest.log".  Same comment as in the previous
paragraph.

Oh, wait, now I think I see what you're saying.  You're saying that
your procmail log for this set of recipes is called "spamtest.log",
and it has that LASTFOLDER entry, yet you can't find any spam.log
file.  Right?  The answer is because of your errant backtick, 
mentioned in paragraph 1 of my response.

Third, my echo command doesn't have an -e switch, so I don't
know what you want with that, but okay.  I also get a literal
"\n" at the end of the line in spam.log when I run your recipe
after having removed the errant backtick.

Fourth, there's no real reason to resort to the echo command here.
Why not use LOGFILE?

   LOGFILE = foo

   blah, blah, blah

   :0
   * $ ^Subject:.*\/[^$WS].*
   {
       MAILDIR = spamtest
       LOGFILE = spam.log
       LOG     = "$TIME bounce address $MATCH $NL"  # assumes $NL was set
       DEFAULT = spamtest/gotcha
       SWITCHRC
   }

(Untested.)


Note how my match invocation differs from yours.  Yours expects one
space after "Subject:".  There could be more, or tabs, or none.

The reason you have nothing saved is, you are invoking a delivering
message with your echo action.  The message was fed to the pipe.
There is nothing left to deliver to the second recipe.  You
probably will also have error messages show up in the log when the
message is longer than the buffer allocated to the pipe.

Dallman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail