procmail
[Top] [All Lists]

Re: Using formail

2001-03-30 13:53:05
Rob Dege has this code:

| What I want to do is modify the Subject line in an email & then have to
| forwarded to another email account.  Here's is what I have:
| 
| :0fhw
| * ^Subject:\/.*
| | (formail -I"To: rcd(_at_)amherst(_dot_)com" \
|            -A"Subject: [$HOST] $MATCH" \
|   ) | $SENDMAIL -t

You don't want to have the `f' flag there.  It stands for `filter' and 
means "replace the text (head and body by default, but only the head here
because you also have the `h' flag) with the standard output of the command.
Then proceed with further code in the rcfile."

Since the standard output of formail is piped to $SENDMAIL, which must be
your MTA and sends nothing back to standard output, you're replacing the
head of the message with *nothing*.  That leaves only the body for procmail
to use on later recipes in the rcfile.

Answer: get rid of the `f' flag ... and since you surely want to send the
body to your other account as well, get rid of the `h' flag.  If you want to
send a copy there and file the original according to other recipes, use the
`c' flag.

One thing Timothy said that I'd like to support: -A is not good for the
"Subject:" field.  You don't want to have multiple subject lines on a
message.  To preserve the original as Old-Subject:, use -i; to drop the
original (you don't really need it in this application, I should think),
use -I.  For a counterexample, though, -A is perfect for X-Loop:.

So all told, change ":0fhw" to just ":0" to send the original to amherst.com
without keeping the message on the site where procmail is running or to ":0c"
to send a copy to amherst.com and to keep the original there (for handling by
later recipes in the rcfile).

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