On Sun, 5 May 1996, Philip Guenther wrote:
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'.
This is nice, it seems to be a bit faster than my old recipe.
What about "* ! ^FROM_DAEMON", it should be in there too, right?
Mark
--
Mark Shadley -- http://www.catcher.com/users/shadcat/
Send blank email to shadcat(_at_)catcher(_dot_)com with subject "get-pgp-key"
for automagic public key retrieval.