Email from the terminal with aerc
Sending and reading email from the terminal was on my list of things to learn, if only because it sounds cool. I finally sat down to try to set something up in earnest, and landed on aerc, which describes itself as “a pretty good email client” (not sure where the aerc name came from). It was much more straightforward than anticipated, and I could see it becoming something I use on a regular basis.
Installation
Installing on Debian was very simple since it is packaged for Bookworm. If you use: Alpine, Arch, Debian, Fedora, openSUSE, homebrew, or Slackware then there should be package for your system. Ubuntu and mint users should be able to use the apt package. Since Bookworm has been out for a while now, the package is a few releases behind the most current.
sudo apt install aerc
Before jumping straight into it with my main account, I thought I would try configuring with a testing account (which would also help with screenshots for this post). I chose to give Fastmail some money for a month to get aerc@fastmail.com
. Please do not email this address, as I will not be renewing it.
Setup
aerc
comes with a wizard to help configure a new account if one is not already setup. Run aerc
with no arguments to start the program and the wizard.
aerc
The wizard is quite straightforward, input the values required and use tab to cycle between the inputs. Instructions for the various providers can be found here, this demo will show Fastmail. The password you would use is an app password, not your main fastmail account password[1].
Note: On Debian the wizard looks different than what is in the providers wiki for Fastmail. I believe this is because of the version difference that should be resolved when Trixie is released, and then JMAP would presumably be an option. I set it up with IMAP in the meantime.
Upon entering an email with a fastmail.com
domain, it was able to pick up the correct settings for IMAP automatically, however I couldn’t send mail. This was due to some incorrect settings for SMTP. Specifically, it didn’t add the smtp
subdomain and port that Fastmail uses. This could have been because I passed through the SMTP section quickly once I saw the password was carried over from IMAP, but still something to double check.
Assuming IMAP is working, you will see something like this.
If you encounter difficulties with sending, check that your configuration file looks like this. It should be located in ~/.config/aerc/accounts.conf
[Testing]
source = imaps://aerc%40fastmail.com:your_app_password@imap.fastmail.com:993
outgoing = smtps://aerc%40fastmail.com:your_app_password@smtp.fastmail.com:465
default = INBOX
from = Just Testing <aerc@fastmail.com>
copy-to = Sent
Sending mail
Accidentally sending email with just a single keystroke was one of my worries going into terminal email, but with aerc
this really isn’t a concern. There are multiple stages to review before sending, and many inputs required. Use <Shift>c
to compose a new message[2].
Having the ability to compose emails in neovim as an editor is so cool. After composing something, exit the editor (in this case, with :q
, the same as in vim) to enter the next stage.
Setting catppuccin mocha colours
I was happily surprised when there was a catppuccin port for aerc!. To use the mocha colours, first create a stylesets
directory in the aerc configuration folder.
cd ~/.config/aerc
mkdir stylesets
cd stylesets
After creating the directory, create a mocha-catppuccin file (no extension) with the following contents.
*.default=true
*.normal=true
default.fg=#cdd6f4
error.fg=#f38ba8
warning.fg=#fab387
success.fg=#a6e3a1
tab.fg=#6c7086
tab.bg=#181825
tab.selected.fg=#cdd6f4
tab.selected.bg=#1e1e2e
tab.selected.bold=true
border.fg=#11111b
border.bold=true
msglist_unread.bold=true
msglist_flagged.fg=#f9e2af
msglist_flagged.bold=true
msglist_result.fg=#89b4fa
msglist_result.bold=true
msglist_*.selected.bold=true
msglist_*.selected.bg=#313244
dirlist_*.selected.bold=true
dirlist_*.selected.bg=#313244
statusline_default.fg=#9399b2
statusline_default.bg=#313244
statusline_error.bold=true
statusline_success.bold=true
completion_default.selected.bg=#313244
[viewer]
url.fg=#89b4fa
url.underline=true
header.bold=true
signature.dim=true
diff_meta.bold=true
diff_chunk.fg=#89b4fa
diff_chunk_func.fg=#89b4fa
diff_chunk_func.bold=true
diff_add.fg=#a6e3a1
diff_del.fg=#f38ba8
quote_*.fg=#6c7086
quote_1.fg=#9399b2
Next, add a small additional bit in the main aerc.conf
file.
[ui]
border-char-vertical="│"
border-char-horizontal="─"
styleset-name=catppuccin-mocha
With that, you should have a functioning email client in the terminal, using whichever editor you like. If you get it successfully set up, feel free to send me an email and we can celebrate!
When I began, I considered using my old gmail for this tutorial. To save the next searcher some time, Google’s app passwords page is https://myaccount.google.com/apppasswords, I couldn’t find it in any navigation menus. ↩︎
A full manpage can be accessed from within the application by typing
:help
, so I won’t go over all the commands here. There are a lot! ↩︎
- ← Previous
What is the purpose of a phone?