procmail
[Top] [All Lists]

Re: save message on autoreply

1996-05-05 10:23:14
Stan Ryckman <stanr(_at_)sunspot(_dot_)tiac(_dot_)net> writes:
I find the following conceptually simpler.  (I usually use the "tee"
when debugging things, and then it's easy to yank it out of the pipe.)

  MAILDIR=$HOME/Mail

  :0:
  * !^Subject:.*Re:
  * ^Subject:.*get-pgp-key
  | (formail -r ; cat $HOME/.pgpheader $HOME/.pgpkey) | \
      tee -a Shadcat | $SENDMAIL -oi -t

Not to tear your idea to pieces, but...

This saves a copy of the *outgoing* message to "Shadcat".  Also, I don't
think formail propogates the 'From ' header, so Shadcat won't be in proper
mailbox formail.  It doesn't work if Shadcat is a directory style mailbox,
and finally, you need to specify and explicit lockfile, as there's no ">>"
in the above command.

That said, (:-)) some of the above can be fixed via tweaks.  Add a lockfile
and move the tee earlier in the pipe:

:0:Shadcat.lock
* ! ^Subject:.*Re:
*   ^Subject:.*get-pgp-key
* ! ^X-Loop: my-mailbox(_at_)my(_dot_)site
| tee -a Shadcat | (formail -rA"X-Loop: my-mailbox(_at_)my(_dot_)site"; \
        cat $HOME/.pgpheader $HOME/.pgpkey) | $SENDMAIL -oi -t

That fixes all the but the directory style mailbox problem.

Interestly, the procmail solution (reversed from David's original answer):

:0
* ! ^Subject:.*Re:
*   ^Subject:.*get-pgp-key
* ! ^X-Loop: my-mailbox(_at_)my(_dot_)site
| (formail -rA"X-Loop: my-mailbox(_at_)my(_dot_)site"; \
        cat $HOME/.pgpheader $HOME/.pgpkey) | $SENDMAIL -oi -t
    :0 A:
    Shadcat

actually uses one fewer process than the solution using 'tee'.

Philip Guenther

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