next up previous contents
Next: Other Resources and More Up: Advanced Customization Previous: Advanced Printing: Mutt-Print   Contents


Hooks for Sending, Accounts, and More

Hooks are great ways to provide conditional functionality. They perform actions when certain criteria are met. For example, a set of folder hooks could say ``list all my mailboxes in `date received' order except the `Office Jerks' folder, which I want listed by sender;'' a send hook could say ``whenever the recipient is `Charlie' change my return address to the following; an account hook could say ``whenever I'm looking at the imap://ISP-two.com account, my password is the following.'' That's all there is to it.

Hooks come in many flavors: folder-hooks, send-hooks, message-hooks, save-hook, mbox-hook, fcc-hook, and fcc-save-hook. I mostly use folder-hooks to choose a sorting pattern appropriate to the folder I'm looking at. Here are some examples, but if you think about the possibilities this functionality provides you'll see just how powerful they are.

# Folder Hooks
  folder-hook /var/spool/mail/randymon set sort=date-received
  folder-hook Avalon-list set sort=threads
  folder-hook '!' set sort=received

# Send Hooks
  send-hook '~t tgw@ISP-one.com$' 
        'my_hdr From: Fat Penguin <eatmore@fish.com>'
  
  send-hook '~t @hotmail.com$' 
       'my_hdr From: Tough Guy <name@address.com>'



Randall Wood 2009-12-02