Mutt is a Linux email client that allows you to edit messages in your favorite terminal editor (which should be nvim btw).
Let’s go through how to set it up to work with Gmail.
Installation
CentOS
yum install mutt
Ubuntu
sudo apt-get install mutt
Arch
sudo pacman -S mutt
Setup
Edit the ~/.muttrc
and add the following:
set realname = "<first and last name>"
set from = "<gmail username>@gmail.com"
set use_from = yes
set envelope_from = yes
set smtp_url = "smtps://<gmail username>@gmail.com@smtp.gmail.com:465/"
set smtp_pass = "<app password>"
set imap_user = "<gmail username>@gmail.com"
set imap_pass = "<app password>"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set ssl_force_tls = yes
# G to get mail
bind index G imap-fetch-mail
set editor = "vim"
set charset = "utf-8"
set record = ''
Most of the config is pretty trivial but the <app password>
is where I got stuck. Most online tutorials instructs to simply put your Gmail password but that won’t work. Instead head here:
Once you login, you can generate a new app specific password for this use case. This way, you’ll also won’t have to worry about saving your main password in a plaintext file.
After generating, simply plop it into the ~/.muttrc
file and run mutt
and you will see it download all emails from your inbox. Most of the key are indicated at the top of the screen so it should be relatively intuitive.
Visit https://gitlab.com/muttmua/mutt/wikis/home for more detailed guides on controls and such.
Edit: After a short while you’ll realize that Mutt is completely pointless because most modern emails are made with HTML templates which means you’ll just see a bunch of code. Maybe there’s a plugin solution?