August 26, 2020

Email - Mutt

I used Mutt for many years and liked it. I only switched because at the time, MIME support was virtually non-existent. People would send me emails with photos attached, and it was as easy as rebooting my operating system to look at them. If this is somehow better these days, mutt will be a total win.

These days there is also neomutt. This is a mutt fork that I don't yet fully understand. Does it indicate that mutt itself is no longer being maintained, or is being maintained in some clumsy way? At any even, neomutt is not in the standard Fedora 32 packages list, so I just install mutt:

su
dnf install mutt
If I want to try out neomutt someday, here are the instructions:

Setting up mutt with my gmail account

The first thing is a Google setting: Here are some pages that discuss setting up mutt with Gmail. Then, as myself (not root):
cd
mkdir -p .mutt/cache/headers
mkdir .mutt/cache/bodies
touch .mutt/certificates
cd .mutt
vi muttrc
I start with the muttrc file given in the Centos link above:
set ssl_starttls=yes
set ssl_force_tls=yes
set imap_user = 'xyz@gmail.com'
set imap_pass = 'PASSWORD'
set from='xyz@gmail.com'
set realname='Your Name'
set folder = imaps://imap.gmail.com/
set spoolfile = imaps://imap.gmail.com/INBOX
set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
set header_cache = "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"
set smtp_url = 'smtps://xyz@gmail.com:xyz@gmail.com:465/'
set move = no
set imap_keepalive = 900
I merged in some of the stuff from the second (Ubuntu) link. I type mutt, and bingo! It shows me my mailbox. The first email I see if from Paypal and it whines that it can't show me html content and gives me a link that I can use to get it. I just delete the message. Already this is great.

But can I send mail? Yes I can. This is great, and easier than I expected.

Mutt and HTML email

One fellow says:
The small file .mailcap is your key to happy life.

What about messages with photo attachments, or links to web pages? One fellow says:

"... make sure you ... set up links or elinks as your html view handler, so HTML-only emails can actually be read without extreme difficulty for those cases where a client sent an HTML email without a plain-text companion.
One guy says to put this in your .mailcap ...
text/html; elinks -no-connect -dump -dump-charset UTF-8 -dump-width 140 -default-mime-type text/html %s; needsterminal; copiousoutput;
Of course, you also need to:
su
dnf install elinks
Indeed, this is a big improvement -- now links in the message are presented in a sane way and don't get chopped and folded across lines, so I can use the mouse to "view link in browser".

Mutt and photo attachments

Use "v" to get the attachment viewer, the select the JPG files or whatever it is. Mutt then tried to launch "ristretto" (and did, but without passing the photo to it).

The general idea is to put a line like this into .mailcap:

Image/JPEG;view_attachment %s
image/jpeg;ristretto %s

Mutt and an address book

The basic scheme is handled by the mutt "alias" command:
alias wally My dear pupil Wally wally@spam.com
You can just tack these onto your muttrc file, or put them into a separate "aliases" file and source that from muttrc. Consider the following:
set alias_file = ~/.mutt/aliases
set sort_alias = alias
set reverse_alias =yes
source $alias_file
There are also many address book add-on things for mutt: goobook looks particularly interesting as it connects you to your google contacts.

Copy my Thunderbird address book

This is kept in vcf format (whatever that is) and there are ways to translate that to a mutt alias list. Someone even wrote a ruby program "vcf-to-mutt". Fedora has a "vcftools" package. I installed it, but it apparently does not contail the vcf-to-mutt script.

Thunderbird lets you use Tools -- Address Book, then export the address book as csv. Then some nice fellow wrote a python script to convert this to a mutt alias list.

I wouldn't "just work", so I chopped away on it.

Random mutt stuff


Have any comments? Questions? Drop me a line!