procmail
[Top] [All Lists]

adding a footer and forwarding (as changing the subject and forwarding)

2000-08-18 11:33:22
Matt Dunford answered Rupinder Singh Gill,

| Hmmm, this is not one of my strong points.

You seem strong enough.

| # 'fb' -- filter body of message
| :0fb
| * ^Subject:.*test
| | (cat -; cat /path/to/footer/file)
| 
| # if previous recipe succeeded, forward message
| :0A
| ! c(_at_)hostname(_dot_)com

One improvement and one correction: change the action of the first recipe to

   | cat - /path/to/footer/file

that way procmail will invoke cat directly instead of invoking a shell that
in turn has to run cat twice.

This will also work:

  | sed '$ r /path/to/footer/file'

but in most OSes sed is a bigger program to fork than cat and, since sed
would have to keep checking for end-of-file at every newline, it would
probably run more slowly than cat for this particular operation.

Now the correction: the capital-A flag means (approximately) "if the previous
recipe [actually, the most recent recipe that had neither an `A' nor an `a'
flag] *ran*."  If you want to run a recipe only if the previous one *suc-
ceeded*, it's the lower-case-a flag.

As to which to use here, that depends on what Rupinder would want to do if
a message came that was supposed to get the footer but for some reason the
footer didn't get added.


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