Notes
Email from the command line
Managing email with Himalaya from the terminal: review, filter, and delete
2 min read
Email is background work: it comes in constantly, most of it isn't important, and if you open it every moment it weighs down your day. Opening a heavyweight client just to delete three spams and a newsletter seemed like a poor investment of time. From the terminal —working by typing commands, without windows— the same task takes ten seconds.
What Himalaya is
Himalaya is an email client for the command line: it reads the mailbox via IMAP (the protocol a program uses to query the server for mail) and sends via SMTP (the sending protocol), with support for multiple accounts at once. It doesn't replace the graphical client for writing long emails, but for reviewing, filtering, deleting, and replying quickly it's a different world.
Everyday commands
# list the latest emails from an account
himalaya envelope list -a account
# read one
himalaya message read -a account 1234
# delete one
himalaya message delete -a account 1234
# move it to a folder
himalaya message move -a account -f Folders 1234
Everything has an identifier, and with that you can perform any management without leaving the terminal.
My triage
Over the years I've come up with some simple triage rules (the quick sorting of what comes in):
- Straight out: spam, phishing (emails that imitate others to steal your data), bounces, no-reply, SEO offers. I don't argue with junk mail.
- Listed to decide: newsletters and commercial emails. I review them from time to time and decide whether they continue or not.
- Always: real people. No automation touches these.
Where it gets interesting
The trick isn't typing commands, but combining them with cron —the system scheduler, the same one that runs my disk watchdog with cron—: a periodic review that sorts what comes in, leaves clean what is clean, and only notifies you when there's something worth looking at. Email goes from being a constant interruption to being a queue that manages itself, and only what belongs to you reaches you.