Last modified: 2023-03-29

aerc

Info

aerc is a terminal-based e-mail client with Vim-style keybindings.

Rant on email and it's design flaws

Let me just start by saying that sure, email is nice and all, but it is so obsolete technology.

And there are far too many "hotfixes" and additional layers of complexity just to keep it running these days in somewhat secure way. The protocol was simply not designed well, there is no security in mind, so many features were added on as afterthought and many things lack standardization.

I have underwent a process of creating my own email server and oh boy, that is a pain in the ass. So many loops and hoops you have to get though ...

Warning

aerc is a work in progress.

Warning

aerc is designed to work as online client - there is no offline storage by default.

MailDir can be manually added by editing the config file, but it comes with few caveats.

Warning

gmail does not work out of the box! You need 2FA (2 Factor Authentification) and special app password, but thankfully both of these are rather easy to setup.

It used to be enought to Allow Less Secure Apps in account settings, but that is no longer possible. See aerc mailing list: invalid credentials and Less secure apps & your Google Account

What I will describe here is setup of aerc to work offline and with multiple accounts. Regarding email providers, I will try to get following to work:

  • Google / Gmail
  • Microsoft / Outlook
  • Protonmail
  • Tutanota
  • My personal email server

And I will use the following software:

Tip

Given the modular nature of the setup, you can use other software.

Sources I have used for inspiration:

The structure

  • all emails will be stored in MailDir format for offline use
  • the local MailDir will be synchronised with email server via mbsync/isync, triggered by goimapnotify using push notifications
  • outgoing emails will be handled by msmtp which will queue them until online
  • aerc will be acting as user interface
  • khard will be used as address book
  • keepassxc will store passwords for the email accounts

The MailDir can be anywhere, but I will use ~/.mail, and each account will have it's subdirectory:

~/.mail
|-- account1
|   |-- INBOX
|   `-- ..
|-- account2
`-- ...

First issues

The first problem that I can see is that there is a lot of redundant configuration. The email accounts are defined in practically each of the used programs. If you have multiple accounts, it will be a lot of work.

Config files that need account details:

  • aerc: ~/.config/aerc/accounts.conf
  • mbsync/isync: ~/.mbsyncrc (I will move this to ~/.config/mbsyn/mbsyncrc.conf - do this in sync script)
  • goimapnotify: ~/.config/imapnotify/<account>.conf
  • msmtp: ~/.config/msmtp/config

I will start by configuring everything manually, one thing at the time, and slowly add on the layers. At the end, I will create a script for handling the configuration for me.