procmail
[Top] [All Lists]

Re: .backward files

1999-06-10 11:45:54
When Jost Schaper asked,

|  > I would like to have parts of my outgoing mail beeing sorted into
|  > folders. Sorted by the customer's adresses.
|  > Just the body, as the rest is well known.
|  > How can I do that?

First, I'd suggest keeping some part of the head, if only From_, unless your
folders are directories and the bodies will be kept in separate files.  If
you will be appending to a plain file for each client, and you keep only
bodies, you won't always be able to tell where one message's body ends and
the next one begins.  On the other hand, the particular format of these 
messages may make it clear where one ends and the next starts, so perhaps
that isn't a problem.

Era Eriksson replied, in part,

| So let's say you manage to set up your config so that you will be
| piping all outgoing message into "| procmail $HOME/.backward" ...

I would strongly recommend using the -m option when you call procmail to
handle outgoing mail.  That way, if your MUA puts recipient addresses on
the command line as positional parameters to hand them over to the MTA,
procmail -m will preserve them, and you can finish the rcfile with a
simple

:0
! "$@"

You can call it with    | procmail -m $HOME/.backward "$@"   in the first
place, or I find that it is easier to name an executable script file whose
first line is

#!/path/to/procmail -m

though that requires an OS that honors hash-bang lines.

If procmail identifies a piece as appropriate for having recipients read
from its header lines, you can have a recipe in the file that does this:

:0
* conditions
! -t


|     SHELL=/bin/sh
|     MAILDIR=$HOME/Mail
|     DEFAULT=OUT.oops
| 
|     :0:
|     * ^TO_client1
|     OUT.client1
| 
|     :0:
|     * ^TO_client2
|     OUT.client2
| 
|     :
|     # etc ad naus. -- one recipe for each client address

Or

 :0b: # Jost wanted to keep only the bodies.
 * ^TO_\/(client1|client2|client3|client4|...)
 OUT.$MATCH

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