On Sat, Mar 13, 1999, john manoogian III ([EMAIL PROTECTED]) said:
|
| how can i have a send-hook -like function that will be called *after*
| i compose a message? i want to post-process a message after i compose
| it, but i couldn't find a function to do it, since send-hook happens
| before you compose the body. this would be analogous to a sending
| filter in pine, eg. the way pine handles pgp.
What I do is to change the $sendmail vars to point to a shell script,
which does the post-processing I want, and then itself invokes the
sendmail(8) program.
Eg, in my .muttrc I have:
set sendmail="sendmail.startup -t -oi -oem"
set sendmail_bounce="sendmail.startup -oi -oem"
and sendmail.startup looks something like:
#!/bin/sh
#
tfile1="/tmp/foo$$.1"
tfile2="/tmp/foo$$.2"
sendmail="/usr/lib/sendmail"
# Make a copy of the email from stdin, for grep'ing and sed'ing, or
# whatever ...
#
touch $tfile1 $tfile2 # ensure that the temp
chmod 0600 $tfile1 $tfile2 # files are private
cat >$tfile1
##
## Post-process the outbound message ($tfile1) here; the result should
## end up in $tfile2.
##
# And send the message off ...
#
cat $tfile2 | $sendmail "$@"
rm $tfile1 $tfile2
exit
#
##--eof--##
It would be nice if mutt had a *real* send-hook (in addition to the
existing ill-named form), which could be specified on a per-message
basis, but I haven't implemented such a thing, since the post-processing
that I do is relatively limited, and easy enough to fob off to the
script.
Perhaps such a strategy can be adapted to do what you want, without
too much difficulty ... perhaps not ...
/kim