procmail
[Top] [All Lists]

Re: include custom scripts

2005-10-09 05:53:29
On Sun, Oct 09, 2005 at 01:06:20PM +0200, Ruud H.G. van Tol wrote:

Dallman Ross:

conditions by default send only the header to the pipe.

I think you are mixing up the hb and HB flags there.

You're causing me to doubt my recollection (because you
usually speak the truth, and you've caught me out a couple
of times), but I don't think so.

I had written:

  :0
  * HB ?? !? $YourFtpScript
  {
    LOG = "error in mail delivery
    "
  }



Okay, given this rcfile, called "rc.testing":

 DEFAULT = /dev/null

 :0
 * ? cat > /dev/tty
 { }



And given this test message:

  From testing(_at_)example(_dot_)com  Sun Oct  9 13:14:35 2005
  Date: Sun, 09 Oct 2005 13:06:20 +0200
  From: "Dallman Ross" <testing(_at_)example(_dot_)com>
  Subject: This is the Subject
  Message-id: <06a001c5ccc1$7ce7fd20$0b01a8c0(_at_)example(_dot_)com>
  
  This is the one-line body.



I can run it and, as expected, get the header-only on
the condition line:


   2:26pm [~/Mail] 564[0]> procmail -m rc.testing < sample
  From testing(_at_)example(_dot_)com  Sun Oct  9 13:14:35 2005
  Date: Sun, 09 Oct 2005 13:06:20 +0200
  From: "Dallman Ross" <testing(_at_)example(_dot_)com>
  Subject: This is the Subject
  Message-id: <06a001c5ccc1$7ce7fd20$0b01a8c0(_at_)example(_dot_)com>
  


Now I'll change the condition to

 * hb ?? ? cat > /dev/tty



   2:29pm [~/Mail] 570[0]> procmail -m rc.testing < sample
  
   2:29pm [~/Mail] 571[0]>


Nothing shows up, which is what I expected.  Now I'll put
in "HB" instead of "hb":

   2:31pm [~/Mail] 575[0]> procmail -m rc.testing < sample
  From testing(_at_)example(_dot_)com  Sun Oct  9 13:14:35 2005
  Date: Sun, 09 Oct 2005 13:06:20 +0200
  From: "Dallman Ross" <testing(_at_)example(_dot_)com>
  Subject: This is the Subject
  Message-id: <06a001c5ccc1$7ce7fd20$0b01a8c0(_at_)example(_dot_)com>
  
  This is the one-line body.
  


That's what I expected.  We need "HB" to see the header and body
together in the condition.  (Default is just the header.)

Recapping (and now I'll write this for a broader audience than
just you, Ruud), there are two ways to do this:

(1)      :0 HB
         * condition
         action

or (2)   :0
         * HB ?? condition
         action

and we prefer the second way, because of a bug in some versions
or procmail that cause the first way to result in a "sticky"
H-flag for the duration of the run.


We don't need "hb" to see the header and body together in the
action line, since that is the default for the action line.
(We get the whole message delivered, not just the header
and not just the body.)

Summarizing, remember that "H" and "B" are for conditions (with "H"
by itself being the default); and "h" and "b" are for actions (with
both together being the default).

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

<Prev in Thread] Current Thread [Next in Thread>