Can anybody help me with mutt configuration?
I need to configure mutt to support mutiple accounts the same time.
At this moment my config file for personal email looks like this:
~ $ cat ~/.mutt/personal
set imap_user = «%personal_email%@gmail.com»
set imap_pass = «%personal_email_pass%»
set smtp_url = «smtps://%personal_email%@smtp.gmail.com:465/»
set smtp_pass = «%personal_email_pass%»
set from = «%personal_email%»
set realname = «%username%»
set hostname = gmail.com
set folder = «imaps://%personal_email%@imap.gmail.com:993»
set spoolfile = «imaps://%personal_email%@imap.gmail.com/INBOX»
set postponed = «imaps://%personal_email%@imap.gmail.com/[Gmail]/Drafts»
set record = «imaps://%personal_email%@imap.gmail.com/[Gmail]/Sent Mail»
"~/.mutt/work" looks the same way, except the values of "%personal_email%" and "%personal_email_pass%", of course.
"~/.muttrc" looks like this:
~ $ cat ~/.muttrc
source «~/.mutt/personal»
macro index <f2> '<sync-mailbox><enter-command>source ~/.mutt/personal<enter><change-folder>!<enter>'
macro index <f3> '<sync-mailbox><enter-command>source ~/.mutt/work<enter><change-folder>!<enter>'
When I press F2 or F3 mutt really changes an account, but when I'm trying to change mailbox (via 'c' -> '?') it opens a mailbox of the first account (in my case "personal") even when the current account is "work".
Why? What am I doing wrong? How can I fix it?
Best Answer
Some trickery with hooks. You might want to think twice about storing passwords into
.muttrc
. At least take care to use application specific passwords instead of your main Google account password when you do something as insecure as this.Now all there is left to it is to fire up mutt, then hit y and select the folder for an account you want.
If you want more secure setup, your favorite search engine can tell you how to secure IMAP/POP passwords for Mutt with PGP. Realname/from is left as an exercise for the reader.