A look at the aerc mail client
Email has become somewhat unfashionable as a collaboration tool for open-source projects, but there are still a number of projects—such as PostgreSQL and the Linux kernel—that expect contributors to send and review patches via email. The aerc mail client is aimed at developers looking for a text-based, efficient, and extensible client that is meant to be used for working with Git and email. It uses Vim-style keybindings by default, and has an interface inspired by tmux that lets users manage multiple accounts, mails, and embedded terminals at once.
Why is it called that?
By terminal-based email client standards, aerc is relatively new. The popular Mutt text-based email client was first released in 1995, and its fork NeoMutt was first released in 2016. The venerable Pine mail client was first released in 1992, and its rewrite Alpine appeared in 2007. At only six years old, aerc is a new kid on the block. Drew DeVault made the first commit to the aerc project in January 2018, and announced the 0.1.0 pre-release in June 2019. The project is written in Go, and made available under the MIT License.
The name was something of a mystery, so I emailed DeVault to ask
where it came from. He replied that it originally stood for
"asynchronous email reading client
", to signify that the
user interface and the network code to communicate with IMAP
servers, etc., were decoupled to make the user experience better. That
name, he said, was not very meaningful and "soon fell into the
dustbin of history
".
DeVault posted a notice to his aerc repository in January 2022 that development had moved to a fork maintained by Robin Jarry. That fork has seen active development ever since. Aerc 0.18.0, announced in July, is the most recent major release. That represented about five months' work, with 25 people contributing to the release. It included a lot of minor fixes and small enhancements, such as a new :bounce command for message resending, an :align command for positioning a message at the top, bottom, or center of the message list, and more. The most recent minor release (0.18.2) came out on July 29 with a small number of fixes.
Aerc is packaged for most, if not all, major Linux distributions and is also available in the Ports system for FreeBSD and OpenBSD as well as NetBSD's packages collection. I started out with the package in Fedora 40 but moved to compiling from source a few weeks later to get the most recent updates. So far, the main branch has been perfectly stable.
Retrieving and sending mail
Aerc currently supports reading email using IMAP, JMAP, notmuch, Maildir, and Maildir++ as backends. It works with SMTP and Sendmail for sending mail. Aerc provides a new-account command that will walk the user through a text-based configuration wizard to set up aerc to send and receive email.
The new-account utility only configures the bare minimum to retrieve and send emails. It is likely that users will want to edit the account configuration to add a signature, modify the interval for checking mail, use GnuPG for signing, and so forth. Account settings are stored in a plain-text file found in $HOME/.config/aerc/accounts.conf. See the accounts.conf man page for more information. All of aerc's configuration files are stored under .config/aerc by default.
A basic configuration looks something like this:
    [Account Name]
    source = maildir://~/mymail
    outgoing = smtps://user:<password>@smtp.myhost.com
    default = INBOX
    from = Aerc User
    copy-to = Sent
    signature-file = ~/.signature
    
Note that aerc will store IMAP, JMAP, and SMTP passwords in plain text in its configuration file during setup, which is not ideal from a security perspective. Users may want to use the source-cred-cmd directive in accounts.conf to run an external command, such as pass, to retrieve the password from an encrypted source.
The aerc interface
Aerc is started by running aerc in a terminal. Unlike most text-based mail clients, aerc has a tabbed interface and allows users to have multiple accounts and emails open at the same time. It displays the account's folders on the left-hand side of the screen and emails on the right-hand side. If a user has more than one account configured, each one will be displayed in its own tab. Navigation is done using Vim-style keybindings: k and j to move up and down (respectively) in the message list, K and J to move up and down the folder list, and Enter to open a message or folder. Control-n and Control-p cycle between tabs.
As with Vim, the prefix to run commands is the colon key (:). New users may wish to try out the tutorial by running :help tutorial, which displays the tutorial man page with some basic instruction on its movement keys, the message viewer, composing messages, and the built-in terminal.
Typing : and hitting the Tab key displays a pop-up of commands that are available, which users can select by hitting Tab again until the desired command is highlighted, or typing the first few letters and hitting Tab to complete the command. For example, :compose will open the message composer, :reply -a -q will start a reply with the original email quoted in the default editor, and :terminal will open a new terminal within aerc.
Just as Vim has modes, such as normal mode for running commands, insert mode for editing text, and so forth, aerc has contexts. The available contexts for aerc include messages (viewing the list of messages in an account), view (actually viewing a single message), compose, and terminal. Users can use ? to display a list of key bindings that are available in whatever context they happen to be in.
Customizing aerc
As one might expect, aerc's keybindings are customizable and users can create keybindings to run command sequences of their own. Its keybinding configuration is found in $HOME/.config/aerc/binds.conf. The bindings are organized by context, and it is possible to use a binding to do different things depending on the context that aerc is in. The format for bindings is simple, the key sequence to be used and the command to be run. As an example, this would set up a shortcut to move a message to the spam folder in a user's work account:
    [messages:account=Work]
    S = :read<Enter>:move Spam<Enter>
All of aerc's default keybindings are defined in this file as well—so users can reconfigure things to their heart's content. It should be possible, for example, to set up aerc to use Mutt shortcuts instead or even Emacs-style keybindings. (Though Emacs users would probably be loath to exit Emacs to use an external mail client.)
Users can hide mailbox folders and/or change the order in which they are displayed by adding folders and folders-sort directives to the accounts.conf file under the appropriate account. Users can also remap folder names to be more useful. For example, when using aerc with a Gmail account, users might want to remap the default IMAP names like "[GMAIL]/Spam" to just "Spam". (Or "spam spam spam spam..." if they've watched entirely too much Monty Python's Flying Circus.) For example, this would tell aerc to only display the inbox, Sent, and Archive folders for an account, in that order, and to look to the file specified by folder-map to find the remapping for "[Gmail]/Sent" to Sent.
    folders = INBOX,Archive,Sent
    folders-sort = INBOX,Sent,Archive
    folder-map = /home/user/.config/aerc/folders
In the folders file, this stanza would remap the folder name:
    Sent = [Gmail]/Sent
Much of aerc's interface is customizable as well. For example, it's possible to rearrange the width and order of message columns (from, subject, date, etc.), the width of the folder sidebar, and much more. Basic configuration is available in the aerc.conf file (see the aerc-config manpage for more information), and users can style the user-interface colors and such using stylesets. The styleset feature is not merely for prettifying aerc's interface, though it's certainly suitable for that purpose. Stylesets can be used to highlight messages that match certain conditions, so that they're easier to spot in the message list. For instance, these stanzas will color messages that match "FR" (for review) in the subject, and messages sent to lists.debian.org or lists.postgresql.org:
    msglist_*.Subject,~FR.fg=#a64b2a
    msglist_*.To,~lists.debian.org.fg=#4e6a79
    msglist_*.To,~lists.postgresql.org.fg=#f0ece2
Running :reload after saving new rules will let them take effect without needing to restart aerc. The catppuccin/aerc repository has a few examples of stylesets that aerc users might want to use or borrow from.
Using aerc
Even though aerc is a terminal-based and keyboard-driven application, it has mouse support (assuming the terminal it is running in supports it). This can be enabled by setting mouse-enabled to true in aerc.conf. It allows selecting tabs, folders, and messages using the mouse, and scrolling through the message list with the mouse wheel. Beyond that, though, aerc has no menus to speak of—so the utility of the mouse is limited.
Reaching for the mouse is a productivity speed bump anyway. It's never really necessary to reach for the mouse while using aerc, everything a user would want to do is available via the keyboard. Almost everything, anyway. Emails and attachments can be piped to external commands using the :pipe and :open commands from within aerc. If an email contains a link the user would like to visit, the :open-link command will send it to the default web browser.
Aerc does not support using the mbox format but it can import and export the format with the :import-mbox and :export-mbox commands. This might be handy for moving mail out of another program into Aerc, or for importing archives from mailing lists.
Editing messages is handled by the external editor of the user's choice. By default, aerc will use whatever editor is specified by $EDITOR, but this can be modified in the aerc.conf file using the editor directive, like so:
    editor=nano
One of the primary use cases for aerc is collaborating with other people using Git via email. The expectation is that developers would send patches using Git's send-email command in a terminal running within aerc, and manage patches using the :patch command, which applies patches to a Git repository directly from within aerc. The sourcehut tutorial for using email and Git provides a good overview of using git send-email and the corresponding tutorial for reviewing contributions explains how to use aerc to review patches and provides a sample review project to work with.
Searching
Aerc has two commands that are useful for searching through one's email when using IMAP or a Maildir backend: :search and :filter, which have the same syntax but slightly different behaviors. Searching highlights matching messages and lets the user navigate to matching messages using n (forward) and N (backward). When filtering, only matching messages are displayed—which makes it handy to use to operate on messages in bulk. This command, for example, would match all messages in a folder that match the term Firefox in the last week:
    :filter -d this_week -b Firefox
Note that it's possible to run :filter more than once to narrow results, but a new :search replaces the old results. For example, one could run the above command to filter messages sent in the last week that contain the word "Firefox" in the body. Running another :filter command would further narrow the results rather than running a new search on the folder. Filtered results can be searched, too. Running :filter with no arguments will clear the filters and show all messages in the folder. Note that filtering is persistent until aerc is restarted or cleared—if a user filters messages in their Inbox folder and then switches to another folder and back, the filter in the Inbox would still be active. That may run counter to expectations and provoke a "where did all my mail go?" (or stronger) reaction if one is new to aerc.
If using the notmuch backend, users can work with the notmuch syntax for the :filter and :search commands. Aerc also has a :query command for creating a virtual folder from a notmuch query.
The aerc project realizes that even developers have to take meetings on occasion. If a message has a meeting invite, users can use the :accept and :decline commands to generate a reply to the calendar invite that should let the sender update their calendar accordingly. Note that this does not update the aerc user's calendar, which will need to be done manually by piping the text/calendar part to a separate handler.
Overall, aerc is a highly customizable mail client with a small but active community behind it. I've found it very usable for managing multiple accounts with large amounts of email. There was a slight decline in productivity during the first week or two while tinkering with settings and keybindings, but that passes quickly. Performance-wise, aerc handles large amounts of mail stored locally very well. Sorting, searching, filtering, and operating on thousands of messages at once is almost instantaneous—though mileage may vary depending on the system resources available to aerc. It also performs well with an IMAP backend, though that is somewhat dependent on the service. Working with mail stored on LWN's server using IMAP has been notably faster than Fastmail, but I have more than a decade's worth of email stored on Fastmail's servers. It may be well past time to delete some of the newsletters and automated notices from previous decades from my archives.
It is worth signing up for the aerc-discuss and aerc-devel mailing lists for users who adopt aerc as their primary mail client. Both lists are low-volume and have useful discussions about using and improving aerc.
Despite the low version number, aerc has proven stable and feature-complete enough to for daily use. It will be interesting to see how the project evolves in the near future, and if it ever reaches a 1.0 release.
      Posted Oct 18, 2024 8:40 UTC (Fri)
                               by Herve5 (subscriber, #115399)
                              [Link] (1 responses)
       
     
    
      Posted Oct 18, 2024 11:37 UTC (Fri)
                               by jzb (editor, #7867)
                              [Link] 
       
     
      Posted Oct 18, 2024 13:54 UTC (Fri)
                               by raven667 (subscriber, #5198)
                              [Link] (1 responses)
       
     
    
      Posted Oct 18, 2024 16:04 UTC (Fri)
                               by AlecTavi (guest, #86342)
                              [Link] 
       
     
      Posted Oct 21, 2024 15:36 UTC (Mon)
                               by jond (subscriber, #37669)
                              [Link] 
       
     
    no POP, alas?
      
      It doesn’t support POP natively, but if you have a tool that can fetch mail from a POP server and store it in Maildir format that would work. 
      
          no POP, alas?
      Support for OAUTH
      
Support for OAUTH
      
      aerc managed to move me off mutt after more than 20 years. I still fire up mutt once in a blue moon, but I usually suspect I can achieve what I want in aerc if I spent more time reading its features.
Some tricks I like:
hints
      
thread-prefix-folded=""
column-flags = {{if .ThreadFolded}}{{printf "🧵%d" .ThreadCount}}{{else}}{{.Flags | join ""}}{{end}}
      
          
           
![The
aerc mailer [The aerc mailer]](https://static.lwn.net/images/2024/aerc.png)