Plaintext email - the bane of my existence and my reluctance to actually contribute to the Linux kernel...

But I needed to send an email to an open source mailing list, so I figured it's once again time to figure out how to do this. Lots of searching and lots of outdated results, but finally I came across something that almost worked! However, as of 2022, it's just a bit outdated -- Google no longer allows you to use less secure apps without enabling 2FA and creating an "App Password". I asked the author if they'd be willing to update the post, but in case they don't, here's the instructions I used:

Step 1: Set up Google account 2FA and create an App Password for mutt

Go to manage your google account, then select Security from the left hand side. Look for "2 Step Verification" and turn it on. Jump through some hoops to get it going. Once enabled (or if you already had it enabled), go to the "App passwords" settings. Create a new password -- I used the "Other" option in the image below.

genpass

Give it a name (I chose mutt for obvious reasons) and click generate. You'll get a 16 character long string that is now your mutt-specific password. Write it down or save it in your password manager, you'll need this later!

genpass2

Just an example -- this is NOT my actual app password. I'm no security expert, but I'm not THAT dense. Although it looks like there are spaces, the actual password does not have spaces in it.

Sidenote to future me: You saved this as a note associated with your plaintext email account in your password manager.

Step 2: Install mutt.

sudo apt install mutt

Step 3: Create magic mutt directories/files:

I guess it's going to need somewhere to store headers/bodies/certificates? Either way, create the following:

mkdir -p ~/.mutt/cache/headers
mkdir ~/.mutt/cache/bodies
touch ~/.mutt/certificates

Step 4: Create a muttrc configuration file

To open muttrc file in vim: vim ~/.mutt/muttrc

After opening it, just copy-paste the below code and set imap_user, imap_pass, smtp_url, realname and from fields to the correct settings for your name, username and app password from step 1.

# ================  IMAP ====================
set imap_user = yourusername@gmail.com
set imap_pass = app-password-from-step1
set spoolfile = imaps://imap.gmail.com/INBOX
set folder = imaps://imap.gmail.com/
set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
set mbox="imaps://imap.gmail.com/[Gmail]/All Mail"
set header_cache = "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"
# ================  SMTP  ====================
set smtp_url = "smtp://yourusername@smtp.gmail.com:587/"
set smtp_pass = $imap_pass
set ssl_force_tls = yes # Require encrypted connection
# ================  Composition  ====================
set editor = "vim"      # Set your favorite editor.
set edit_headers = yes  # See the headers when editing
set charset = UTF-8     # value of $LANG; also fallback for send_charset
# Sender, email address, and sign-off line must match
unset use_domain        # because joe@localhost is just embarrassing
set realname = "Your Name"
set from = "yourusername@gmail.com"
set use_from = yes

This seems to be a viable minimal working configuration.

Step 5: Run mutt

mutt

If the internet stars are aligned, you'll now have a working gmail-based way to send, receive and reply to plaintext emails using a gmail address (at least until Google changes something and renders this obsolete).

Previous Post