Instant messaging apps may be very prevalent in today’s environment but email is still king. With that said choosing the most appropriate email client is something that presents you with many options. Of those options for those interested in something a bit different you have the console based email client Neomutt. Neomutt is a fork of the email client Mutt, its essentially the same client but with many improvements to improve usability.
Neomutt is a great email client but it does take some configuration effort on the users part. There are many different ways to configure Neomutt but for our setup I will be using a four part method. What I mean by that is that I will be using four different programs working together to accomplish a usable email client from the console. The programs we will be using are pass for password management, isync for receiving and syncing email accounts, msmtp for sending emails and Neomutt for bring it all together.
The first thing you want to do is ensure your email accounts passwords are stored properly. Normally you would enter your email account info directly into the Neomutt config file but this is considered bad practice since this file is stored in cleartext. Instead we will be using pass a password manager found on most Linux distros. Once we have pass set up we will be calling it from inside msmtp and isync when accessing your email accounts. Follow the below steps to get pass set up.
$ sudo pacman -S pass #To Install pass $ pass init firstname.lastname@example.org #To initiate your password storage $ pass add email@example.com #To add a password for your email account
Neomutt does have native SMTP support for sending emails but I find it easier to manage multiple accounts by using an external method. That’s were “msmtp” comes in handy. “msmtp” is a SMTP client that we can call from inside Neomutt. Follow the steps below to get “msmtp” set up.
$ sudo pacman -S msmtp #To Install msmtp $ mkdir ~/.config/msmtp #To create configuration directory location $ vim ~/.config/msmtp/config #To create and configure the configuration file. Add the below info replacing **firstname.lastname@example.org** with your information
# Enter the following configuration swapping out "email@example.com" with your information. account firstname.lastname@example.org #This is your email account host smtp.example.com #This is your email servers smtp host account. Normally starts with "smtp." but check with your provider to make sure. port 587 #This will either be 587 or 465 but check with your provider to make sure. from email@example.com #Your email account user firstname.lastname@example.org #Your email account passwordeval "pass email@example.com" #This will call pass to access the password you stored for your email account auth on tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile ~/.config/msmtp/msmtp.log #This is the log file location for msmtp. It is in the same location as the config file # tls_starttls
Just like SMTP Neomutt has IMAP support built in but for our needs we will be using an external source via “isync”. Follow the steps below to get “isync” set up.
$ sudo pacman -S isync #To install isync $ vim ~/.mbsyncrc #To create and configure the configuration file. Add the below settings replacing **firstname.lastname@example.org** with your information.
IMAPStore email@example.com #Your email account plus "-remote" added to the end Host imap.example.com #Your email servers IMAP host. Normally email providers domain name lead by a "imap." but check with your provider just to make sure Port 993 #Should for the most part be 993 but check with your provider just to be sure User firstname.lastname@example.org #Your email account PassCmd "pass email@example.com" #This will call pass to access the password you stored for your email account AuthMechs LOGIN SSLType IMAPS CertificateFile /etc/ssl/certs/ca-certificates.crt MaildirStore firstname.lastname@example.org #Your email account plus "-local" added to the end Subfolders Verbatim Path ~/.email@example.com/ #The location of where your emails will be stored. Can be any location just make sure you put the correct path Inbox ~/.firstname.lastname@example.org/INBOX #The location of your INBOX for your email. Will be in the directory of your email path location. See above Channel email@example.com #Your email account Expunge Both Far :firstname.lastname@example.org: #Your email account Near :email@example.com: #Your email account Patterns "INBOX" "*" Create Both Sync All SyncState * # End profile
Now that you have all the other components set you need to configure Neomutt to get everything working together. We will be creating three files for this. The first file will be named config, this file will be used to declare some global settings and source the other two files. The second file will be called email, this file is where you will place your actual email account information. The third file will be called bindings and will be used to declare all key bindings. Be sure to change all occurrences of firstname.lastname@example.org with your information.
$ sudo pacman -S neomutt #To install neomutt $ mkdir ~/.cache/neomutt #To create the neomutt cache directory. $ mkdir ~/.config/neomutt #To create neomutt configuration directory $ mkdir ~/.config/neomutt/accounts #To create the neomutt email accounts directory $ mkdir ~/.mail #To create the mail account parent directory $ mkdir ~/.email@example.com #To create the email account directory $ vim ~/.config/neomutt/config #To create and configure the neomutt configuration file. Add the below information to the config file replacing **firstname.lastname@example.org** with your information
# vim: filetype=muttrc source ~/.config/neomutt/bindings #To source the file were you have all your key bindings declared source ~/.config/neomutt/accounts/email #To source your email account profile info macro index O "<shell-escape>mbsync -V -a<enter>" "run mbsync to sync all accounts"
$ vim ~/.config/neomutt/accounts/email
Neomutt email config
## Neomutt Config # vim: filetype=neomuttrc set realname = "Your Name" set from = "email@example.com" set sendmail = "msmtp -a firstname.lastname@example.org" alias me Info <email@example.com> set folder = "~/.firstname.lastname@example.org" set header_cache = ~/.email@example.com/headers set message_cachedir = ~/.firstname.lastname@example.org/bodies set mbox_type = Maildir set hostname = "example.com" set spoolfile = +INBOX set postponed = +Drafts set trash = +Trash set record = +Sent macro index o "<shell-escape>mbsync -V email@example.com<enter>" "run mbsync to sync firstname.lastname@example.org" mailboxes "=Trash" "=Junk" "=INBOX" "=Drafts" "=Sent" "=Archive" macro index,pager gi "<change-folder>=INBOX<enter>" "go to inbox" macro index,pager gj "<change-folder>=Junk<enter>" "go to drafts" macro index,pager gt "<change-folder>=Trash<enter>" "go to trash"
$ vim ~/.config/neomutt/bindings
Neomutt bindings config
## Bindings Config # Set the default editor set editor = "vim" # Set pager to be viewable while reading emails set pager_index_lines = 10 # Sorts emails by newst to oldest set sort = reverse-last-date-received # General Key Bindings bind index,pager g noop bind index gg first-entry # Takes me to the top of the mailbox bind index G last-entry # Takes me to the bottom of the mailbox bind index j next-entry bind index k previous-entry bind attach <return> view-mailcap bind attach l view-mailcap bind index l display-message bind pager j next-line bind pager k previous-line bind pager l view-attachments bind pager,attach h exit bind index,pager S sync-mailbox set sidebar_visible = yes set sidebar_width = 20 set sidebar_short_path = yes bind index,pager B sidebar-toggle-visible set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S" set mail_check_stats set sidebar_non_empty_mailbox_only = yes set pager_format = "[ %D ] %?r?[ %m ] ?%?n?[ %n ] ?%?d?[ %d ] ?%?t?[ %t ] ?%?F?[ %F ] ?%?p?[ %p ]?%|─"
Once you have everything set up run the following commands to start Neomutt:
$ mbsync -V -a #To sync your your email account, when prompt for your password enter it $ neomutt #To start neomutt
If you run into any issues please refer to the official Neomutt Page and the Arch Wiki for better assistance.
Overall I would say Neomutt is a fantastic email client for those that live in the terminal. If you have no experience or desire to work out of the terminal then I would urge you to stay away and stick to your typical GUI client.