See the parent document: Using the Terminal as a Daily Driver for more about terminal productivity applications.

Terminal email clients are a beast unto themselves. It is one thing to set up the email client and another to set up the email client so it automatically synchronizes mail from various servers. And, sync calendars and address books, and provide organizing and searching capabilities for your mailboxes. Did I mention, managing your passwords?

Setting up this kind of email client will give you a much deeper understanding of what happens when sending and receiving email. There are a lot of moving parts that are generally hidden from the user. Having control overall those parts allows customizing everything to meet your individual preferences. Just know, this can be a complex tasks.

I have started with setting up aerc. My first pass with neomutt was a failure that indicated my lack of knowledge of how to email actually works. So, I’m continuing with getting a complete setup for aerc before going back and trying neomutt again.

aerc

I am finding there are multiple ways to configure aerc for handling email.

  1. Load email directly from the email server when aerc loads. This type of configuration does not keep copies of the email on your local computer.
  2. Set up mbsync and sync a copy of your email to a local mail folder on your computer. This retains copies of all your email locally. Each email account has a separate folder. The offloads the email fetching from aerc to mbsync.
  3. Set up notmuch and mbsync to create an aggregated email system that allows quick searching through all of your email.

The full set up will require installing not only the email client, but also some helper tools listed below.

Aerc uses three configuration files (stored in ~/.config/aerc). The files are:

  • accounts.conf - email account information
  • aerc.conf - application configuration file
  • binds.conf - keyboard bindings

binds.conf is interesting because you can create your own key bindings. For example, instead of deleting messages, I wanted to move them to the trash. The trash bin name varies by email account, but I was able to create custom key bindings for each account.

This Blog Post on setting up aerc was very helpful. And another Will Webberley Blog Post was helpful.

The following diagram describes the interactions between the components that make up the email system.

email-flow

  • Email providers: this can be one or more email accounts.
  • Mbsync: responsible for retrieving email from email provider and storing it in a local email folder.
  • Local mail: local folders on the hard drive that contains copies of all email.
  • Pass: provides passwords to mbsync so that it can access the email providers
  • Notmuch: scan and indexes the local email. It can then be a custom email inbox inside of aerc
  • Aerc: the heart of the email system.
    • It reads emails from the local mail folder.
    • Aerc is configured to send emails directly and not through the local storage path (I think that is true)
    • When composing messages, it asks khard to provide contact information.
  • Contacts provider: this can be a remote contact provider. I was using Nextcloud to store all my contacts, but that was overkill since I wasn’t using all the Nextcloud features. I’ve since migrated calendar and contacts to a self-hosted instance of Baikal.
  • Vdirsyncer: synchronizes contacts between a local contact storage location and a web based contacts provider.
  • Local contacts: a folder where all the contact information is stored locally.
  • Khard: a contact management application the reads / writes local contacts and provides email addresses to aerc

Notes

  • I found that deleting an email from the inbox of a Gmail account did “only” that. It removed the email from the inbox, but it still existed in “All Mail”. So the better option was to move the email to trash instead with mv [gmail]/Trash.
  • Started out using abook for looking up addresses in aerc. But, after setting up vdirsyncer to work with email addresses, I switched over to khard.

Additional tools

The following additional CLI applications are used in order to manage and synchronize email messages and contact information. Each application has their own section below.

  • mbsync: IMAP email syncing program
  • Notmuch: global email search and tag management
  • Vdirsyncer: synchronize calendars and address book between servers and a local file store.
  • khard: address book application (using v0.19.1)
  • abook: address book application (using v0.6.1)
  • khal: calendar application
  • Pass: password management tool - uses GPG as well.

vdirsyncer

Configuration file is ~/.config/vdirsyncer/config. Copied the config.example file to get the base configuration set up.

khard

Address book files are stored in ~/.contacts by default. Directories inside of .contacts are the address books and are configured in khard.conf. Address book records are stored in individual .vcf vCard files inside of the address book folders (e.g.~/.contacts/family). For my particular configuration, I’ve moved the address book to ~/.config/khard/addressbook/contacts/ by changing the khard.conf as follows:

[addressbooks]
[[contacts]]
path = ~/.config/khard/addressbook/contacts/

Configuration file is ~/.config/khard/khard.conf.

Khard is written in python. This means that I might be able to do some work on it if I feel the need.

The configuration line in aerc.conf (or in accounts.conf for individual accounts) is as follows:

address-book-cmd=khard email -a contacts --parsable --remove-first-line %s

See the abook equivalent in the abook section below.

abook

Abook has a nice interface for entering addresses manually. Just run abook. Abook’s documentation is practically non-existent. Also, didn’t like that the source code was stored on Sourceforge which isn’t as familiar as GitHub.

Address book files are stored in the ~/.abook folder. The file addressbook contains the list of addresses. The file abookrc contains configuration information.

abook is written in c.

abook --mutt-query %s | tail -n +2

# aerc.conf configuration line to use abook as your email address provider
address-book-cmd=sh -c 'abook --mutt-query "%s" | tail -n +2'

Abook Data file

The data file ~/.abook/addressbook has a simple file format which would lend itself to modification with either a text editor or programmatically with python or another programming language.

# abook addressbook file
[format]
program=abook
version=0.6.1

[0]
name=Darla Doe
email=nanaboo@yahoo.com

[1]
name=Alice Toe
email=AliceT123@gmail.com

So, if you are thinking about using another tool to modify the address book file, it’s good to know what fields are available. Here is a list of the available fields that can be added to the address book.

name
email (comma delimited list of email addresses)
address
address2
city
state
zip (postal code)
country
phone
workphone
fax
mobile
nick
url
notes
anniversary (date in the form YYYY-MM-DD)
groups (comma delimited list of groups)
custom1
custom2
custom3
custom4
custom5

mbsync

This application will synchronize email mailboxes from a server to your local computer. This will take out the lag that occurs when opening individual emails. Eliminating the lag when getting into your email is a gamechanger. However, if you don’t have a lot of email or multiple email accounts, this may not be a big deal.

Note: isync is the project name; mbsync is the executable program name.

This article helped me to crack getting my Gmail to sync locally with mbsync.

Configuration file: .mbsyncrc Mail Folder: ~/.local/share/mail/[mailbox folder]

Pass

  • pass - password management tool

The Linux password management tool.

notmuch

  • Notmuch - global email search and tag management

Check out this overview video of notmuch.

Notmuch indexes all your email allowing you to search for messages.

# Check if `aerc` was built with `notmuch` support.
aerc -v
aerc 0.17.0 +notmuch-5.6.0 (go1.22.2 amd64 linux 2025-06-19)

Getting started notmuch commands:

# a configuration routing that asked about your 
notmuch setup

# create the initial database and index the email
notmuch new

# search all email
notmuch search "python"

# display a certain email based on the thread id found while searching.
notmuch show thread:0000001 | less

notmuch Configuration

Khal

During my exploration of command line productivity tool, Khal and Calcurse have emerged as the leaders among calendaring applications. It turns out, you can add an additional tab to the aerc application. This makes it very easy to work with your calendar while going through email.

The default aerc configuration file comes with a line commented out that will enable calcurse. Here is the tweak I made to change it over to include khal on the extra tab.

#aerc-startup=aerc :terminal calcurse && aerc :next-tab
aerc-startup=aerc :terminal ikhal && aerc :next-tab

Note: There is a separate article about CLI calendars here: CLI Calendar

Neomutt

I have tried to configure neomutt twice now. I’ve also tried using the mutt-wizard to configure it. I have not gotten far. My Gmail accounts have been a killer. It looks like a good email client, but my lack of understanding has gotten in the way. So, for now, I am going to focus on maximizing my aerc configuration.