Mutt + Gmail

Jeff T
Jeff T
Feb 6, 2018 · 2 min read
Image for post
Image for post
A more complicated Mutt setup

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 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?

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store