aerc Setup Guide

aerc is a "modern" TUI email client, originally made by the behated capitalist lolicon Drew DeVault (also the owner of the SourceHut Git forge and a prominent freedesktop.org shill), who tried (and failed horribly) to "cancel" Richard Stallman for his past opinions. The program is good enough though, and is much better than mutt/neomutt and other horrific GUI clients, which is why I chose it in my Dotfiles. This article will guide you to set up an account!

While aerc does have built-in IMAP support, we will instead use a synchronizer such as mbsync (provided by the isync package) to fetch your emails locally into a Maildir structure. This lets aerc act purely as a fast, local reader, guaranteeing instant startup times and full offline access to your mail. Here's an example of my ~/.config/isyncrc:

# isync configuration

IMAPAccount ayari
Host disroot.org
Port 993
User ayari@disroot.org
PassCmd "pass show 'Email/ayari@disroot.org'"
TLSType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt

IMAPStore ayari-remote
Account ayari

MaildirStore ayari-local
SubFolders Verbatim
Path ~/.local/share/mail/ayari/
Inbox ~/.local/share/mail/ayari/Inbox
Flatten .

Channel ayari
Far :ayari-remote:
Near :ayari-local:
Patterns "INBOX" "Drafts" "Sent" "Junk" "Trash"
SyncState *
Create Both
Expunge Both
MaxMessages 0
ExpireUnread no

Of course, I'm not idiotic enough to store my password in plain text, instead using PassCmd to pipe pass' output to mbsync. Before you run mbsync -a to synchronize your Maildir, you must create the directory structure or it'll complain and crash; consider putting something like mkdir -p ~/.local/share/mail/ayari in your shell's init script (bashrc, zshrc, config.fish, etc.).

Now that your mail is saved locally with the mbsync -a command, you can configure aerc to read from that directory and send mail via SMTP. Open (or create) ~/.config/aerc/accounts.conf:

# aerc accounts configuration

[ayari]
source = maildir://~/.local/share/mail/ayari

outgoing = smtps://ayari%40disroot.org@disroot.org:465
outgoing-cred-cmd = pass show 'Email/ayari@disroot.org'
from = ayari 
pgp-self-encrypt = true

default = Inbox
postpone = Drafts
copy-to = Sent
copy-to-replied = true

folders = Inbox,Drafts,Sent,Junk,Trash
folders-sort = Inbox,Drafts,Sent,Junk,Trash

check-mail = 2m
check-mail-cmd = mbsync ayari
check-mail-timeout = 20s

cache-headers = true

Notice that the outgoing format requires URL encoding; you must encode your email address' @ symbol as %40, otherwise the parser will shit itself trying to resolve the hostname. The @disroot.org:465 part simply follows the @[host]:[port] format.

Yeah, that's pretty much it. You can add as many Maildirs and aerc accounts as you'd like. If you want to set up GPG encryption, check out GnuPG Guide > Integrations > aerc!