2

There are many articles on this topic none of which work for me. The .muttrc has the following related to multiple accounts (only IMAP is used + of course SMTP):

source "~/.mutt/account1"
folder-hook $folder 'source ~/.mutt/account1'
source "~/.mutt/account2"
folder-hook $folder 'source ~/.mutt/account2'

macro index <f2> '<sync-mailbox><enter-command>source ~/.mutt/account1<enter><change-folder>!<enter>'
macro index <f3> '<sync-mailbox><enter-command>source ~/.mutt/account2<enter><change-folder>!<enter>'

# Mailboxes
bind    index   G  imap-fetch-mail
macro   index   gi "<change-folder>=INBOX<enter>"       "Go to Inbox"
macro   index   gs "<change-folder>=$my_sent<enter>"    "Go to Sent"
macro   index   gd "<change-folder>=$my_drafts<enter>"  "Go to Drafts"
macro   index   gt "<change-folder>=$my_trash<enter>"   "Go to Trash"

The account files are as (e.g. for account1, the other one would be the same but the names of the folders would be in different language):

set my_drafts             = "Drafts"
set my_drafts_noquote     = "Drafts"
set my_sent               = "Sent<quote-char><space>Items"
set my_sent_noquote       = "Sent Items"
set my_trash              = "Deleted<quote-char><space>Items"
set my_trash_noquote      = "Deleted Items"
set imap_user             = "username"
set folder                = "imaps://outlook.office365.com:993/"
set imap_authenticators   = "login"
set mbox                  = "+INBOX"
set spoolfile             = "+INBOX"
set record                = +$my_sent_noquote
set postponed             = +$my_drafts_noquote
set trash                 = +$my_trash_noquote
set smtp_url              = "smtp://username@smtp.office365.com:587"
set smtp_authenticators   = "login"
set copy                  = "yes"
account-hook $folder "set imap_user=username"

So after starting mutt, i end up being in INBOX for account2. If I press gs, gd or gt all of them get me where I want to be (Sent folder, drafts or trash). Then I switch to account on by F2 and get to INBOX folder correctly but gs, gt, gd no longer work (Note that account1 and account2 use different names for trash, drafts and sent). (What it shows is "Sent items" does not exist but the words "sent items" are written in language of account2 but with malformed characters).

How do i need to correct the configuration?

0

I finally found the resolution, so if someone got in the same issue, the answer is to add to the account1 and account2 files mapping for the sortcuts, that is from muttrc, the lines

bind    index   G  imap-fetch-mail
macro   index   gi "<change-folder>=INBOX<enter>"       "Go to Inbox"
macro   index   gs "<change-folder>=$my_sent<enter>"    "Go to Sent"
macro   index   gd "<change-folder>=$my_drafts<enter>"  "Go to Drafts"
macro   index   gt "<change-folder>=$my_trash<enter>"   "Go to Trash"

also have to be at the end of sourced accout1 and account2 files. It seems that mutt fills in the value of the variables when reading the configuration for the first time rather than keeping the variable and evaluate the expression for shortcut each time the shortcut is run with the actual variable value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.