[neomutt-users] Handling several email accounts in Neomutt

Andrew Sullivan ajs at anvilwalrusden.com
Sun Apr 2 02:06:16 CEST 2023

You need the liberal use of various hook commands.

# reset everything
account-hook . 'unset imap_user; unset imap_pass; unset smtp_url; unset tunnel;'

# account one
account-hook imaps://[imap-server] 'set imap_user=[ ]; [&c]'
account-hook smtp://[smtp-server] 'set smtp_user=[ ]; [&c.]'
named-mailboxes name-of-mailbox imaps[see above]
folder-hook 'imaps://[as above]' 'set …
[here I do hostname, reverse_name, from, folder, record, spoolfile, imap_autheticators]
send-hook '~f [first account email]' 'set…' [here I do signature, smtp_url, and reinforce folder because for some reason it unsets sometimes.]
send2-hook [reproduces the above, because send2 and send have different consequences]

You re-do this for every account.  I keep it in a .muttrc-accounts file and include it in the main file.

When you c to change mailboxes, select the named mailbox you like.

Hope that helps,


Andrew Sullivan
ajs at anvilwalrusden.com

More information about the neomutt-users mailing list