[notmuch] Fcc, Maildir, and Emacs message-mode -- a bit of code

Jameson Rollins jrollins at finestructure.net
Wed Jan 27 06:44:41 PST 2010


Hey, folks.  Following up on this thread about better fcc handling,
Jesse passed on a simple python script he wrote that uses the python
"mailbox" module to deliver a message on stdin to a specified maildir
directory.  It's very a simple, elegant and general purpose script
(attached).

I then put the following in my notmuch .emacs to use the new script in
message-mode to fcc sent mail to my ~/.mail/sent directory:

;; fcc handler
(defun maildir-deliver-region(destdir)
  (shell-command-on-region
   (point-min) (point-max)
   (concat "maildir-deliver.py -c -s -d " destdir)))
(setq message-fcc-handler-function 'maildir-deliver-region)
(defun my-message-header-setup ()
  (message-add-header "Fcc: ~/.mail/sent"))
(add-hook 'message-send-hook 'my-message-header-setup)

Works like a charm.  Thanks Jesse!

I think we should look at packaging this in a set of notmuch helper
scripts, hopefully including notmuchsync.

jamie.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100127/bde1acc7/attachment.pgp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maildir-deliver.py
Type: text/x-python
Size: 1090 bytes
Desc: python maildir delivery script
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100127/bde1acc7/attachment.py>


More information about the notmuch mailing list