2021-03-10 23:28:27 +00:00
# 📫 Himalaya [![gh-actions](https://github.com/soywod/himalaya/workflows/deployment/badge.svg)](https://github.com/soywod/himalaya/actions?query=workflow%3Adeployment)
2020-12-24 23:36:24 +00:00
2021-01-02 23:49:51 +00:00
Minimalist CLI email client, written in Rust.
2021-03-19 21:18:05 +00:00
*The project is under active development. Do not use in production before the
2021-04-17 22:29:45 +00:00
`v1.0.0` (see the [roadmap ](https://github.com/soywod/himalaya/milestone/5 )).*
2021-03-19 21:18:05 +00:00
2021-01-17 15:03:38 +00:00
![image ](https://user-images.githubusercontent.com/10437171/104848096-aee51000-58e3-11eb-8d99-bcfab5ca28ba.png )
## Table of contents
* [Motivation ](#motivation )
* [Installation ](#installation )
2021-04-17 22:06:11 +00:00
* [Nix ](#nix )
* [Installing using Nix ](#installing-using-nix )
* [Development using Nix ](#development-using-nix )
2021-03-10 21:35:06 +00:00
* [Configuration ](#configuration )
2021-01-17 15:03:38 +00:00
* [Usage ](#usage )
* [List mailboxes ](#list-mailboxes )
2021-03-10 21:35:06 +00:00
* [List messages ](#list-messages )
* [Search messages ](#search-messages )
* [Download attachments ](#download-attachments )
* [Read a message ](#read-a-message )
* [Write a new message ](#write-a-new-message )
* [Reply to a message ](#reply-to-a-message )
* [Forward a message ](#forward-a-message )
2021-03-31 20:57:58 +00:00
* [Copy a message ](#copy-a-message )
* [Move a message ](#move-a-message )
* [Delete a message ](#delete-a-message )
2021-03-11 16:05:01 +00:00
* [Listen to new messages ](#listen-to-new-messages )
2021-04-14 08:28:23 +00:00
* [Completions ](#completions )
2021-04-03 10:02:36 +00:00
* [Interfaces ](#interfaces )
* [GUI ](#gui )
* [TUI ](#tui )
2021-01-17 15:03:38 +00:00
* [License ](https://github.com/soywod/himalaya/blob/master/LICENSE )
* [Changelog ](https://github.com/soywod/himalaya/blob/master/CHANGELOG.md )
2021-04-16 19:47:08 +00:00
* [Sponsoring ](#sponsoring )
2021-01-17 15:03:38 +00:00
* [Credits ](#credits )
## Motivation
2021-03-10 21:35:06 +00:00
Bringing emails to the terminal is a pain. The mainstream TUI, (neo)mutt, takes
time to configure. The default mapping is not intuitive when coming from the
Vim environment. It is even scary to use at the beginning, since you are
2021-01-17 15:03:38 +00:00
dealing with sensitive data!
2021-03-10 22:08:31 +00:00
The aim of Himalaya is to extract the email logic into a simple (yet solid) CLI
API that can be used either directly from the terminal or UIs. It gives users
more flexibility.
2021-01-17 15:03:38 +00:00
## Installation
2021-04-16 08:14:15 +00:00
```sh
curl -sSL https://raw.githubusercontent.com/soywod/himalaya/master/install.sh | sh
2021-01-17 15:03:38 +00:00
```
2021-04-17 22:06:11 +00:00
Read the Nix section below for a Nix-based installation method. *See the [wiki section ](https://github.com/soywod/himalaya/wiki/Installation )
2021-03-11 16:05:01 +00:00
for other installation methods.*
2021-01-17 15:03:38 +00:00
2021-04-17 22:06:11 +00:00
## Nix
[Nix ](https://serokell.io/blog/what-is-nix ) users might find this section relevant.
### Installing using Nix
If you already have Nix installed (without Flakes), run the following command to install himalaya to your home directory:
```bash
nix-env -if https://github.com/soywod/himalaya/archive/master.tar.gz
# Or, `nix-env -if .` from within the source tree checkout
```
Alternatively, if you use Nix with [Flakes ](https://nixos.wiki/wiki/Flakes ), you can directly run himalaya without installing it anywhere:
```bash
nix run github:soywod/himalaya
# Or, `nix run` from within the source tree checkout
```
### Development using Nix
To enter a development shell,
```bash
nix develop
```
From here, you have access to all the development tools (Rust compiler, cargo, rust language server, code formatter, etc.) necessary to hack on himalaya.
If you use VSCode, simply open this project folder - and accept the workspace extension recommendations.
#### Troubleshooting Nix
- See [here ](https://github.com/soywod/himalaya/pull/76#discussion_r609710097 ) if you get the `hash mismatch in fixed-output derivation` error.
2021-01-17 15:03:38 +00:00
## Configuration
```toml
# ~/.config/himalaya/config.toml
name = "Your full name"
2021-03-10 21:35:06 +00:00
downloads-dir = "/abs/path/to/downloads"
2021-04-03 10:02:36 +00:00
signature = "Regards,"
2021-01-17 15:03:38 +00:00
[gmail]
default = true
2021-03-11 23:07:01 +00:00
email = "your.email@gmail.com"
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
imap-host = "imap.gmail.com"
imap-port = 993
2021-03-11 23:07:01 +00:00
imap-login = "your.email@gmail.com"
2021-03-11 16:05:01 +00:00
imap-passwd-cmd = "pass show gmail"
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
smtp-host = "smtp.gmail.com"
smtp-port = 487
2021-03-11 23:07:01 +00:00
smtp-login = "your.email@gmail.com"
smtp-passwd-cmd = "security find-internet-password -gs gmail -w"
2021-01-17 15:03:38 +00:00
```
2021-03-11 16:05:01 +00:00
*See the [wiki section ](https://github.com/soywod/himalaya/wiki/Configuration )
for all the options.*
2021-01-17 15:03:38 +00:00
## Usage
```
2021-04-16 22:09:06 +00:00
himalaya 0.2.6
2021-01-14 23:02:15 +00:00
soywod < clement.douin @ posteo . net >
2021-01-02 23:49:51 +00:00
📫 Minimalist CLI email client
USAGE:
2021-04-08 22:15:16 +00:00
himalaya [OPTIONS] [SUBCOMMAND]
2021-01-02 23:49:51 +00:00
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
2021-01-17 09:03:19 +00:00
OPTIONS:
2021-04-03 10:02:36 +00:00
-a, --account < STRING > Selects a specific account
2021-04-08 22:15:16 +00:00
-l, --log < LEVEL > Defines the logs level [default: info] [possible values: error, warn, info, debug,
trace]
2021-04-03 10:02:36 +00:00
-m, --mailbox < MAILBOX > Selects a specific mailbox [default: INBOX]
2021-04-08 22:15:16 +00:00
-o, --output < FMT > Defines the output format [default: plain] [possible values: plain, json]
2021-01-17 09:03:19 +00:00
2021-01-02 23:49:51 +00:00
SUBCOMMANDS:
2021-04-03 10:02:36 +00:00
attachments Downloads all message attachments
copy Copy a message to the targetted mailbox
delete Delete a message
flags Handles flags
forward Forwards a message
2021-01-15 11:21:07 +00:00
help Prints this message or the help of the given subcommand(s)
2021-04-03 10:02:36 +00:00
idle Spawns a blocking idle daemon
list Lists all messages
mailboxes Lists all mailboxes
move Move a message to the targetted mailbox
read Reads text bodies of a message
reply Answers to a message
save Saves a raw message
search Lists messages matching the given IMAP query
2021-03-10 21:35:06 +00:00
send Sends a raw message
template Generates a message template
2021-04-03 10:02:36 +00:00
write Writes a new message
2021-01-02 23:49:51 +00:00
```
2021-01-17 15:03:38 +00:00
2021-03-11 16:05:01 +00:00
*See the [wiki section ](https://github.com/soywod/himalaya/wiki/Usage ) for more
information about commands.*
2021-01-17 15:03:38 +00:00
### List mailboxes
2021-03-10 21:35:06 +00:00
![image ](https://user-images.githubusercontent.com/10437171/104848169-0e432000-58e4-11eb-8410-05f0404c0d99.png )
2021-01-17 15:03:38 +00:00
2021-03-11 16:05:01 +00:00
Shows mailboxes in a basic table.
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
### List messages
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
![image ](https://user-images.githubusercontent.com/10437171/104848096-aee51000-58e3-11eb-8d99-bcfab5ca28ba.png )
2021-01-17 15:03:38 +00:00
2021-03-11 16:05:01 +00:00
Shows messages in a basic table.
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
### Search messages
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
![image ](https://user-images.githubusercontent.com/10437171/110698977-9d86f880-81ee-11eb-8990-0ca89c7d4640.png )
2021-01-17 15:03:38 +00:00
2021-03-11 16:05:01 +00:00
Shows filtered messages in a basic table. The query should follow the
[RFC-3501 ](https://tools.ietf.org/html/rfc3501#section-6.4.4 ).
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
### Download attachments
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
![image ](https://user-images.githubusercontent.com/10437171/104848278-890c3b00-58e4-11eb-9b5c-48807c04f762.png )
2021-01-17 15:03:38 +00:00
2021-03-11 16:05:01 +00:00
Downloads all attachments from a message directly to the
[`downloads-dir` ](https://github.com/soywod/himalaya/wiki/Configuration ).
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
### Read a message
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
![image ](https://user-images.githubusercontent.com/10437171/110701369-5d754500-81f1-11eb-932f-94c2ca8db068.png )
2021-01-17 15:03:38 +00:00
2021-03-11 16:05:01 +00:00
Shows the text content of a message (`text/plain` if exists, otherwise
`text/html` ).
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
### Write a new message
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
```bash
himalaya write
2021-01-17 15:03:38 +00:00
```
2021-03-11 16:05:01 +00:00
Opens your default editor (from the `$EDITOR` environment variable) to compose
a new message.
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
### Reply to a message
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
```bash
himalaya reply --all 5123
2021-01-17 15:03:38 +00:00
```
2021-03-11 16:05:01 +00:00
Opens your default editor to reply to a message.
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
### Forward a message
2021-01-17 15:03:38 +00:00
2021-03-10 21:35:06 +00:00
```bash
himalaya forward 5123
2021-01-17 15:03:38 +00:00
```
2021-03-11 16:05:01 +00:00
Opens your default editor to forward a message.
2021-03-31 20:57:58 +00:00
### Copy a message
```bash
himalaya copy 5123 Sent
```
Copies a message to the targetted mailbox.
### Move a message
```bash
himalaya move 5123 Drafts
```
Moves a message to the targetted mailbox.
### Delete a message
```bash
himalaya delete 5123
```
Moves a message.
2021-03-11 16:05:01 +00:00
### Listen to new messages
```bash
himalaya idle
```
Starts a session in idle mode (blocking). When a new message arrives, it runs
2021-03-11 23:07:01 +00:00
the command `notify-cmd` defined in the [config
2021-03-11 16:05:01 +00:00
file](https://github.com/soywod/himalaya/wiki/Configuration).
Here a use case with [`systemd` ](https://en.wikipedia.org/wiki/Systemd ):
```ini
# ~/.config/systemd/user/himalaya.service
[Unit]
Description=Himalaya new messages notifier
[Service]
ExecStart=/usr/local/bin/himalaya idle
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
```
```bash
systemctl --user enable himalaya.service
systemctl --user start himalaya.service
```
2021-01-17 15:03:38 +00:00
2021-04-14 08:28:23 +00:00
## Completions
```sh
2021-04-15 11:24:18 +00:00
Generates the completion script for the given shell
2021-04-14 08:28:23 +00:00
2021-04-15 11:24:18 +00:00
USAGE:
himalaya completion < shell >
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
2021-04-14 08:28:23 +00:00
2021-04-15 11:24:18 +00:00
ARGS:
< shell > [possible values: bash, zsh, fish]
2021-04-14 08:28:23 +00:00
```
2021-04-15 11:24:18 +00:00
The command prints the generated script to the stdout. You will have
2021-04-14 08:28:23 +00:00
to manually save and source them. For example:
```sh
2021-04-15 11:24:18 +00:00
himalaya completion bash > himalaya-completions.bash
2021-04-14 08:28:23 +00:00
```
```sh
# ~/.bashrc
source himalaya-completions.bash
```
2021-04-03 10:02:36 +00:00
## Interfaces
### GUI
Not yet, but feel free to contribute ;)
### TUI
2021-04-03 10:53:08 +00:00
- [Vim plugin ](https://github.com/soywod/himalaya/tree/master/vim )
2021-04-03 10:02:36 +00:00
2021-04-16 19:47:08 +00:00
## Sponsoring
[![github ](https://img.shields.io/badge/-GitHub%20Sponsors-fafbfc?logo=GitHub%20Sponsors )](https://github.com/sponsors/soywod)
[![paypal ](https://img.shields.io/badge/-PayPal-0079c1?logo=PayPal&logoColor=ffffff )](https://www.paypal.com/paypalme/soywod)
[![ko-fi ](https://img.shields.io/badge/-Ko--fi-ff5e5a?logo=Ko-fi&logoColor=ffffff )](https://ko-fi.com/soywod)
[![buy-me-a-coffee ](https://img.shields.io/badge/-Buy%20Me%20a%20Coffee-ffdd00?logo=Buy%20Me%20A%20Coffee&logoColor=000000 )](https://www.buymeacoffee.com/soywod)
2021-01-17 15:03:38 +00:00
## Credits
- [IMAP RFC3501 ](https://tools.ietf.org/html/rfc3501 )
- [Iris ](https://github.com/soywod/iris.vim ), the himalaya predecessor
2021-03-10 22:08:31 +00:00
- [isync ](https://isync.sourceforge.io/ ), an email synchronizer for offline usage
- [NeoMutt ](https://neomutt.org/ ), an email terminal user interface
- [Alpine ](http://alpine.x10host.com/alpine/alpine-info/ ), an other email terminal user interface
- [mutt-wizard ](https://github.com/LukeSmithxyz/mutt-wizard ), a tool over NeoMutt and isync
- [rust-imap ](https://github.com/jonhoo/rust-imap ), a rust IMAP lib