procmail
[Top] [All Lists]

Re: getting rid of the body of an e-mail

1996-04-30 20:41:14
Das Devaraj asked,

| A part of my .procmailrc file is shown below.  I am trying to generate an
| acknowledgement message when somebody sends a message to 
user1(_at_)foo(_dot_)com
| (other ids in the same domain have different recipes). "HdrLine" is a file
| containing the from line and "AutoMsg" is a file containing the canned
| message which goes back to the sender. 
| 
| The problem is that the return message contains the complete text of the
| original message.  Shouldn't the "h" flag pipe only the headers?  What am
| I overlooking? 
| 
| :0 hc

As Philip Guenther explained, the `h' flag is meaningless there.

| * ^To:(_dot_)*user1(_at_)foo(_dot_)com
| {
|    MAILDIR=$HOME/fileserver
|    :0 fhw 
|    | formail -rA "X-Loop: Processed_Mail"
|    :0 a
|    | cat ./HdrLine - ./AutoMsg >&1 | $SENDMAIL -oi -t
| }

Yes, the `h' flag makes procmail feed only the head, so on a filter recipe
procmail replaces only the head and restores the previous body.  Thus,
formail -r (if you don't also use formail's -k option, and Das didn't),
should drop the body, but procmail is putting it back because only the
head is filtered.

Two possible solutions:

1. Drop the `h' on the filter recipe.  Then procmail will feed the whole
   message to formail, and formail -r (without -k) will lose the body,
   leaving only a head.

2. Add an `h' flag to the cat call.  Then procmail will feed only the
   head to it and lose the body.

Note the contradiction: on a pipe-out recipe `h' loses the body, but on
a filter to a program that would itself drop the body, `h' preserves the
body!

Das should also take Philip's advice about using ^TO_ or ^TO and about
the "2>&1" construct.

<Prev in Thread] Current Thread [Next in Thread>
  • Re: getting rid of the body of an e-mail, David W. Tamkin <=