John --

...and then John Poltorak said...
% 
% I have never understood the purpose of sendhooks or what they can do,
% so I'm probably missing out on a great feature of Mutt...

Oh, my; yes, they are quite cool and fun to boot.


% 
% Can some provide me with a simple sendhook and tell me what I can
% use it for, than I can take it from there.

Well, for the simple stuff, you hardly see the advantages; the nice thing
is that you can do complex things with such hooks.  Here's how mine look:

  send-hook .   unmy_hdr Fcc:
  send-hook .   unmy_hdr From:
  send-hook .   my_hdr From: [EMAIL PROTECTED] (David T-G)
  send-hook .   set signature=$HOME/.mutt/sig
  send-hook .   set pgp_autosign
  send-hook .   unset pgp_autoencrypt

You start off with some defaults, since you don't want your one-time
change to become permanent.


  send-hook [EMAIL PROTECTED] 'unset pgp_autosign ; my_hdr Fcc: /dev/null'

I usually sign everything, but not when forwarding mail to spamcop; I
also don't need to keep a local copy of the spam, so I dump the fcc to
/dev/null.


  send-hook diary       "set nopgp_autosign signature=$HOME/.mutt/sig.daddy"
  fcc-hook diary        =OF.diaries

When I send a diary entry to either of my daughters, I turn off PGP
signing and also change my signature.  I could incorporate the fcc-hook
by using a my_hdr as in the spamcop entry, but this is another way to do
it.


  fcc-save-hook '[EMAIL PROTECTED]|[EMAIL PROTECTED]|[EMAIL PROTECTED]' =APD/%O

Here's another place where a send-hook might be handy if I had anything
else to set.


  send-hook (skip|guckes|[EMAIL PROTECTED])        unset pgp_autosign

These folks (or mailing lists) can't handle PGP attachments, so I turn
off pgp_autosign here.  I'd like to turn this into a clearsign command
using the 1.2x functionality but haven't played with any 1.x settings
whatsoever yet :-)


  send-hook (jimh|kielsky)      set pgp_autoencrypt

These guys not only like signing but encrypting, so I encrypt to them
every time.


As you can see, you can specify just about any mutt command in a
send-hook and it's triggered by your recipient.  The only thing about
this that I don't like is that send-hooks (as well as fcc- and [-]save-
hooks) don't have a way to differentiate between the "primary" recipient
(that which would usually get the fcc, as it appears to me) and any other
(To:|Cc:|Bcc:) recipients.  Thus, with the hooks above and a note
addressed as

  To: joe, skip, jimh
  Cc: [EMAIL PROTECTED]

my Fcc: would be reset to =APD/joe, autosigning would be turned off, and
autoencryption would be turned on -- all of which are probably not what I
really wanted.  I'm still working on a proposal to the developers to get
around this nut :-)


% 
% --
% John

HTH & HAND


:-D
-- 
David T-G                       * It's easier to fight for one's principles
(play) [EMAIL PROTECTED]      * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.bigfoot.com/~davidtg/        Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
The "new millennium" starts at the beginning of 2001.  There was no year 0.
Note: If bigfoot.com gives you fits, try sector13.org in its place. *sigh*

PGP signature

Reply via email to