Multiple accounts with mutt

| 🤔 | 👍 | 👎 |

If you try to use mutt, you will wonder how you're supposed to handle multiple accounts. You will find suggestions to bind some keys to switch to different accounts, use hooks.

My current solution is much simpler: create a configuration file for each account and do not try to handle different accounts in the same process. I have multiple configuration files (one for each account). They are named mutt-foo and are in my PATH (in ~/.bin) with the executable bit:

#!/usr/bin/mutt -F

# ##### Basic config:

set realname = "John Doe"
set from = ""

# Sane configuration:
set send_charset="utf-8"
set ssl_force_tls = yes

set smtp_url  = "smtp://"

set imap_user = "jdoe"
set folder = "imaps://"
set spoolfile = "=INBOX"
set record = "=INBOX"
set postponed = "=Drafts"
set trash = "=Trash"

set header_cache = "~/.mutt/cache/example/"

# ###### UI

set edit_headers = yes

I can call one of the mutt-foo scripts in order to connect to a given account.

The default configuration ~/.mutt/muttrc is a symlink to one of those and is used when mutt is called directly.