Re: How to organize mail in folders?
On date Friday 2007-07-20 15:33:37 +0200, Kai Grossjohann muttered:
> Michelle,
>
> I think there is a misunderstanding. I wanted to understand how other
> people process their email. You are giving me pointers to programs but
> don't describe how you use them.
>
> Here is a potential strategy for handling mail:
>
> - All incoming mail goes to inbox.
> - I process all mails from inbox.
> - Some messages I read, then delete right away.
> - Other messages I read, then archive by project.
> By project means that there is a folder for each project.
> - Some messages I read, then respond to and archive (by project).
> - Some messages I read, decide that I can't handle them right
> away, so I put them in the todo folder. Every morning I go
> through my todo folder.
> - Some messages (often those sent by me) are waiting for responses
> from others. I file those in the "pending" folder. Every
> morning I go through my "pending" folder to see whether a response
> has arrived.
>
> Some of the above steps could be automated. The strategy does not
> handle mailing lists well. But I hope it shows one possible response
> and makes it clear in what way your response differs from what I was
> expecting.
My strategy:
* all mailboxes, both archives and inboxes ones are in maildir format.
* messages are fetched by fetchmail then processed by procmail. Every
mailing list has a corresponding maildir in inbox/, for example I
have inbox/mutt-users, inbox/gnome-list etc, and there is a generic
mailbox (inbox/generic) for all the other mails. I could easily
modify this to have different inboxes where to manage mails incoming
not from ML (e.g. inbox/generic, inbox/work, etc.). I also have an
inbox/almost-certainly-spam and inbox/maybe-spam, where all the
mails marked as spam by spamassassin go.
* for each inbox I have a corresponding mutt snippet in a distinct file.
Every snippet is contained in ~/.mutt/profiles, and is named something like:
10-todo
50-mutt-users
99-spam
I source all these profiles at mutt startup with:
source ~/.mutt/cat-profiles|
in ~/.mutt/mutrc.
cat-profiles contains this:
#! /bin/bash
# cat all the profiles files in a single one file (that is the output of
# this script
# this output is meant to be source by mutt in the muttrc file
find ~/.mutt/profiles/ -perm -700 -type f | sort | xargs cat
This is problematic since an error in some profile results
difficult to detect. The perfect solution would be to have the
source command supports something lke this:
source `find ~/.mutt/profiles/ -perm -700 -type f | sort | xargs cat`
but unfortunately this can't work (source only supports one
filename, though I think it would be simple to change with some
knowledge of the mutt code).
* I have an emacs function which automatically writes the mutt snippet
(profile) for a mailing list. Here it is the elisp code:
(defun muttrc-insert-list-rc (&optional list-address list-nickname attribution
signature)
"Insert a configuration snippet based on the arguments, using the
muttrc-insert-list-rc-skeleton function."
(interactive)
(let* ((list-address (if (null list-address)
(read-string "list address of the mailing list: ")))
(list-nickname (if (null list-nickname)
(read-string "list nickname of the mailing list: "
;; default value
(progn
(string-match "\\([-_[:alnum:]]+\\)@"
list-address)
(match-string 1 list-address)))))
(attribution (if (null attribution)
(read-string "attribution string: "
"On date %d, %n wrote:")))
(signature (if (null signature)
(read-string "signature: " "~/.signatures/en/linux"))))
(skeleton-insert
'(nil
"# write this line in your muttrc file:" \n
`(concat "# source \"~/.mutt/profiles/" list-nickname "\"") \n
\n
`(concat "mailboxes " "\"~/Mail/inbox/" list-nickname "\"") \n
`(concat "subscribe " list-address) \n
\n
"# hook to activate when moving to the corresponding dir" \n
`(concat "folder-hook +inbox/" list-nickname "\\") \n
> "'"
`(concat "save-hook . +archive/recent/" list-nickname)
"'" \n
\n
"# what to do with the messages sent to this profile" \n
`(concat "send-hook '~t " list-address "' \\") \n
> "'"
`(concat "set attribution=\"" attribution "\"") ";\\" \n
> `(concat "set locale=\"en_US\"") ";\\" \n
> `(concat "set signature=\"" signature "\"")
"'" \n
\n
"# where has to be saved the copy of the message sent to this profile" \n
> `(concat "fcc-hook '~t " list-address "' +inbox/" list-nickname) \n
))))
The resulting snippet, with some editing, looks like this:
mailboxes "~/Mail/inbox/mutt-users"
subscribe mutt-users@xxxxxxxx
# hook to activate when changing to the corresponding dir
folder-hook +inbox/mutt-users \
'save-hook . +archive/recent/mutt-users'
# what to do with the messages sent to this profile
send-hook '~t mutt-users@xxxxxxxx' \
'set attribution="On date %d, %n muttered:";\
set locale=en_US;\
set signature="fortune ~/share/fortune/en/mutt-tips|"'
fcc-hook '~t mutt-users@xxxxxxxx' +inbox/mutt-users
* From the profiles snippets, result that every message is
automatically saved in a corresponding archive dir (e.g.
inbox/mutt-users -> archive/recent/mutt-users).
* Every week I have a cron script that runs a perl script which scans
every archive/recent/folder and put the messages older than six
months in a corresponding archive/old/folder-year.
* Messages for which I want to reply are kept in inbox/folder.
* I like to store received and sent messages in the same folder, so my
inbox/generic and archive/{recent,old}/generic contains both
received and sent mails (which seems to me the most meaningful
thing).
HTH.
Cheers
--
mutt random tip #2
Starting from mutt 1.5.12 you can reference variables in commands with the
shell-like syntax: $variable. For example you can do:
source $alias_file