CLI to manage emails
Go to file
Gregory Chamberlain 82ce67f572
improve portability of install.sh (#107)
* Replace echo with printf

The echo(1) command varies among sh implementations.  Some interpret
hyphen command-line options.

It would be unusual, but in theory if $PREFIX began with a hyphen or
two then this usage of echo might cause an error or unknown behaviour
in such implementations.

The printf(1) command is consistent across shell implementations.

* Leave privilege elevation to the user

* Add die function

* Break long line
2021-04-18 11:00:06 +02:00
.github update sponsoring sections 2021-04-16 22:21:24 +02:00
.vscode add nix support (#76) 2021-04-18 00:06:11 +02:00
src split modules into mod.rs files 2021-04-18 00:21:22 +02:00
vim add flag to enable telescope preview and to choose picker (#97) 2021-04-13 17:10:42 +02:00
wiki@fb38ee9b4a add custom config path (#86) 2021-04-17 23:19:34 +02:00
.gitignore add nix support (#76) 2021-04-18 00:06:11 +02:00
.gitmodules import wiki as submodule 2021-04-04 15:32:11 +02:00
Cargo.lock release v0.2.6 2021-04-17 00:09:06 +02:00
Cargo.toml release v0.2.6 2021-04-17 00:09:06 +02:00
CHANGELOG.md add custom config path (#86) 2021-04-17 23:19:34 +02:00
default.nix add nix support (#76) 2021-04-18 00:06:11 +02:00
flake.lock add nix support (#76) 2021-04-18 00:06:11 +02:00
flake.nix add nix support (#76) 2021-04-18 00:06:11 +02:00
install.sh improve portability of install.sh (#107) 2021-04-18 11:00:06 +02:00
LICENSE improve readme 2021-01-17 17:07:23 +01:00
README.md improve portability of install.sh (#107) 2021-04-18 11:00:06 +02:00
shell.nix add nix support (#76) 2021-04-18 00:06:11 +02:00

📫 Himalaya gh-actions

Minimalist CLI email client, written in Rust.

The project is under active development. Do not use in production before the v1.0.0 (see the roadmap).

image

Table of contents

Motivation

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 dealing with sensitive data!

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.

Installation

As root, using sudo:

curl -sSL https://raw.githubusercontent.com/soywod/himalaya/master/install.sh | sudo sh

As a regular user:

curl -sSL https://raw.githubusercontent.com/soywod/himalaya/master/install.sh | PREFIX=~/.local sh

Read the Nix section below for a Nix-based installation method. See the wiki section for other installation methods.

Nix

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:

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, you can directly run himalaya without installing it anywhere:

nix run github:soywod/himalaya
# Or, `nix run` from within the source tree checkout

Development using Nix

To enter a development shell,

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 if you get the hash mismatch in fixed-output derivation error.

Configuration

# ~/.config/himalaya/config.toml

name = "Your full name"
downloads-dir = "/abs/path/to/downloads"
signature = "Regards,"

[gmail]
default = true
email = "your.email@gmail.com"

imap-host = "imap.gmail.com"
imap-port = 993
imap-login = "your.email@gmail.com"
imap-passwd-cmd = "pass show gmail"

smtp-host = "smtp.gmail.com"
smtp-port = 487
smtp-login = "your.email@gmail.com"
smtp-passwd-cmd = "security find-internet-password -gs gmail -w"

See the wiki section for all the options.

Usage

himalaya 0.2.6
soywod <clement.douin@posteo.net>
📫 Minimalist CLI email client

USAGE:
    himalaya [OPTIONS] [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -a, --account <STRING>     Selects a specific account
    -l, --log <LEVEL>          Defines the logs level [default: info]  [possible values: error, warn, info, debug,
                               trace]
    -m, --mailbox <MAILBOX>    Selects a specific mailbox [default: INBOX]
    -o, --output <FMT>         Defines the output format [default: plain]  [possible values: plain, json]

SUBCOMMANDS:
    attachments    Downloads all message attachments
    copy           Copy a message to the targetted mailbox
    delete         Delete a message
    flags          Handles flags
    forward        Forwards a message
    help           Prints this message or the help of the given subcommand(s)
    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
    send           Sends a raw message
    template       Generates a message template
    write          Writes a new message

See the wiki section for more information about commands.

List mailboxes

image

Shows mailboxes in a basic table.

List messages

image

Shows messages in a basic table.

Search messages

image

Shows filtered messages in a basic table. The query should follow the RFC-3501.

Download attachments

image

Downloads all attachments from a message directly to the downloads-dir.

Read a message

image

Shows the text content of a message (text/plain if exists, otherwise text/html).

Write a new message

himalaya write

Opens your default editor (from the $EDITOR environment variable) to compose a new message.

Reply to a message

himalaya reply --all 5123

Opens your default editor to reply to a message.

Forward a message

himalaya forward 5123

Opens your default editor to forward a message.

Copy a message

himalaya copy 5123 Sent

Copies a message to the targetted mailbox.

Move a message

himalaya move 5123 Drafts

Moves a message to the targetted mailbox.

Delete a message

himalaya delete 5123

Moves a message.

Listen to new messages

himalaya idle

Starts a session in idle mode (blocking). When a new message arrives, it runs the command notify-cmd defined in the config file.

Here a use case with systemd:

# ~/.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
systemctl --user enable himalaya.service
systemctl --user start  himalaya.service

Completions

Generates the completion script for the given shell

USAGE:
    himalaya completion <shell>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <shell>     [possible values: bash, zsh, fish]

The command prints the generated script to the stdout. You will have to manually save and source them. For example:

himalaya completion bash > himalaya-completions.bash
# ~/.bashrc

source himalaya-completions.bash

Interfaces

GUI

Not yet, but feel free to contribute ;)

TUI

Sponsoring

github paypal ko-fi buy-me-a-coffee

Credits