muttlearn

In mutt, if want you use multiple sending profiles, you typically create different config files for each profile, and then switch between them by a macro, some program like muttprofile or based on recipient (send-hook) or current folder (folder-hook).

I had different problems with these approaches (mostly due to my laziness):

That's why I wrote the small python program muttlearn, which scans mailboxes that contain outgoing mail, and automatically generates send-hooks. There aren't distinct profiles anymore, but it is learned how you want to write mails based on your prior written emails. Currently, these properties can be learned/generated for a recipient or a group of recipients:

Of course, all this behavior can be customized / switched off partly in the configuration file! Also, muttlearn and the config-file based profiles are not mutually exclusive, they can be used concurrently!

Download

Just get the source from the git repository on github:

git clone https://github.com/weisslj/muttlearn.git

Installation

optional (but recommended) dependencies: guess_language, PyMe

for python >= 2.6

python setup.py install --user
export PATH=$PATH:~/.local/bin

You can also use --prefix but you may need to adapt PYTHONPATH in this case.

for python 2.5:

python setup.py install --prefix ~/.local
export PYTHONPATH=~/.local/lib/python2.5/site-packages
export PATH=$PATH:~/.local/bin

For removal, just delete all installed files, e.g.:

rm -rvf ~/.local/bin/muttlearn ~/.local/lib/python*/*-packages/muttlearn*

Usage

  1. Create a configuration file, either by starting muttlearn or by copying the documented version from doc/ to ~/.muttlearnrc. The most important settings are mailboxes and $output_file.
  2. Make sure your mutt config has alternates correctly set up.
  3. Run muttlearn:
    muttlearn --verbose --progress
  4. Include the generated output file in your ~/.muttrc, for example by appending this line at the bottom:
    source ~/.mutt/automatic-send-hooks

Hints

Future