Managing Multiple Email Accounts#
In this tutorial you will configure two IMAP accounts and switch between them reliably.
If you havenβt connected a first account yet, start with Writing Your First Configuration or the guided Start Here page.
Why Multiple Accounts?#
You might have a personal and a work account, or multiple accounts for different roles. NeoMutt can switch settings automatically based on the mailbox you enter.
If one of your accounts is Gmail or Office 365, follow those setup tutorials for the provider-specific settings, then return here to combine them.
Set Up Folder-Hooks for Account Switching#
Add two folder hooks, one per account:
folder-hook imaps://imap.work.example/ "set folder=imaps://imap.work.example/; set spoolfile=+INBOX; set record=+Sent; set from=work@example.com; set signature=~/.neomutt/sig-work"
folder-hook imaps://imap.personal.example/ "set folder=imaps://imap.personal.example/; set spoolfile=+INBOX; set record=+Sent; set from=me@example.com; set signature=~/.neomutt/sig-personal"
Restart NeoMutt.
Expected result: when you enter a mailbox on each server, the identity settings change automatically.
Use Account-Hook for Credentials#
Add account hooks to set credentials per server:
account-hook imaps://imap.work.example/ "set imap_user=work@example.com"
account-hook imaps://imap.personal.example/ "set imap_user=me@example.com"
Use
account_commandor encrypted helpers for passwords.
Expected result: NeoMutt uses the right credentials for each server.
Organise Mailboxes per Account#
Declare mailboxes for each account:
mailboxes imaps://imap.work.example/INBOX
mailboxes imaps://imap.personal.example/INBOX
Add labels if you want friendly names:
named-mailboxes "Work INBOX" "imaps://imap.work.example/INBOX"
named-mailboxes "Personal INBOX" "imaps://imap.personal.example/INBOX"
Expected result: both accounts appear in mailbox lists and the sidebar.
Configure Sender Identities#
Set identity variables inside each
folder-hook.Optionally add a
send-hookfor specific addresses:
send-hook '~f work@example.com' "set from=work@example.com"
Expected result: the correct sender appears in outgoing mail.
Switch Between Accounts#
Open the Work INBOX, then switch to Personal INBOX.
Press ? to verify the active settings if needed.
Expected result: each mailbox uses its own identity and settings.
Next Steps#
βI want to send from the right identity every time.β See Config Paradigms and Hooks.
βI want to make mailbox switching easier.β See Sidebar Workflows.