[mutt] Multiple email accounts using hooks

This is a continuation of my effort to configure mutt. This post explains how to set up multiple IMAP and SMTP accounts using account-hook and folder-hook. All the configurations go into the file ~/.mutt/muttrc (or ~/.muttrc, if you prefer).

I am assuming that you want to setup mutt for two gmail accounts user1@gmail.com and user2@gmail.com with passwords pass1 and pass2, respectively. I am also assuming that you have saved the passwords in an encrypted file .passwd.gpg in the ~/.secret directory which contains the passwords in the second column as (refer to the previous post):

GMail1: pass1
Gmail2: pass2

as well as the corresponding signatures in user1.sig and user2.sig files in ~/.mutt directory.

Thanks for the rundown. I have refined it a bit. It works perfectly. Of course, you’ll have to define key-bindings for the various folders if you unset imap_check_subscribed. The mailbox screen can be reached by typing c, ?, . Also, it isn’t necessary to set record since Gmail will automatically save sent messages to [GMAIL]/Sent. Although most of the text is wrapped in this reply, said text is actually one line.

You’re right about the ‘set record’ with GMail. Everything you mentioned should work perfectly. However, I just want to make a quick comment: you can set several variables with a single set command as mentioned in the text, that is,

Okay, but how does this work if I set iceweasel (firefox in debian) to use mutt for mailto links
xterm -e mutt “$1”
can I choose which address I am sending from with the same esc-1, or esc-2 binding? Seem that will only go to the inbox.
Or would mutt give me the option for the From: field as it would for subject, etc.?
I currently have two muttrc files (one .muttrc, and one .guttrc, and have aliased gmx to mutt -F .guttrc, since that is gmx.com mail over imap, the first being for gmail over imap), but I haven’t figure out how to allow myself a choice with mailto links.

I had tried with
xterm -e read -p “gmail (mutt) or gmx (gmx)? ” mailprog;
$mailprog “$1”
but the xterm dies as soon as I enter my choice.

If I can use one muttrc for both accounts, as indicated here, I’m assuming this would simplify that.