Mutt tutorial part 1 - setup IMAP account

Mutt is one of those programs that make people call you a linux geek, nerd or a snob. This is because using TUI or command line tools in world of fancy GUI for most people is weird. What’s so great about mutt? I probably still have not found much of its advantages, but at first glance we can notice a few things.

First, it keeps Unix convention of small programs for specific task “Make each program to one thing well” or KISS. This means that mutt is only MUA, which is used to retrieve e-mails and for other tasks you need to use another application. However, due to the philosophy most applications are well suited to each other and usually everything works good. So you can easily combine it with Vim as the mail editor, abook as a address book, urlview as a browser launcher for html and graphics elements and so on. Third, it has support for IMAP which gives very nice usage model for most of e-mail account providers. Fourth, is used by such notables as Greg Kroah-Hartman and as kernel documentation suggest by other kernel developers. So lets start to discover mutt. Below I will discuss some basic features that until now (few days of using mutt) I found useful.

Big kudos to Shinobu for this post it helps me a lot. So first of all we need support for multiple accounts. In my case I have 4 accounts. Three of them got working IMAP access. 4th provider screw up something and access to IMAP server doesn’t work so I need to workaround this with one of the Gmail features. At the beginning we create $HOME/.muttrc file:

vim $HOME/.muttrc

IMAP account configuration for looks like that:

# unset important variables
account-hook . "unset imap_user; unset imap_pass"
account-hook "imaps://<account_name>@<imap_server_address>/" "
    set imap_user = <e-mail_address>
        imap_pass = <e-mail_password>"

# Setup for <e-mail_address>:
set folder = imaps://<account_name>@<imap_server_address>/
# setup needed folders
mailboxes = +INBOX =<folder_name>
set spoolfile = +INBOX
folder-hook imaps://<ccount_name>@<imap_server_address>/ "
   set folder = imaps://<account_name>@<imap_server_address>/
   spoolfile = +INBOX
   postponed = +[Gmail]/Drafts
   record = +[Gmail]/'Sent Mail'
   from = '<your_name> <e-mail_address>'
   realname = '<real_name>'
   smtp_url = smtps://<account_name>@<smpt_server_address>
   smtp_pass =  unset important variables
  • <account_name> - for it will be
  • <imap_server_address> - this information you can get from your e-mail provider help pages or from the settings of web e-mail client, for Gmail it is
  • <e-mail_address> - your e-mail address
  • <e-mail_password> - your e-mail password, later we will discuss how to store this more secure than plain text :)
  • <folder_name> - any folder (for gmail account also filters) you have on you IMAP account, so for gmail account it could be Drafts, Starred, Important or others.
  • <your_name> - your real name or nick anything you want to show in from field
  • <real_name> - could be the same as <your_name>
  • <smpt_server_address> - your SMTP server address, for gmail users it will be

If your e-mail provider have only pop3 access and you have gmail account you can use one of gmail account features to make your pop3 account visible as a IMAP folder.

To do this got to Settings -> Accounts and Import and in the section “Check mail from other accounts” add your POP3 account. After that make sure to label your mails from POP3 account.Try to not use ‘@’ in the label name because this cause problems during mutt configuration. If you set label for your POP3 account check if your label in Label tab have “Show in IMAP” marked, if yes everything was set correctly. To use this label in mutt simply add another <folder_name> to mailboxes line.

Piotr Król
Founder of 3mdeb, a passionate advocate for open-source firmware solutions, driven by a belief in transparency, innovation, and trustworthiness. Every day is a new opportunity to embody the company's vision, emphasizing user liberty, simplicity, and privacy. Beyond business, a casual chess and bridge player, finding peace in nature and nourishment in theology, philosophy, and psychology. A person striving to foster a healthy community, grounded in collaboration and shared growth, while nurturing a lifelong curiosity and a desire to deeply understand the world.