### Install Himalaya Binary Source: https://github.com/pimalaya/himalaya/wiki/Installation:binary Installs the latest Himalaya binary from GitHub releases. Use the first command for root installation and the second for installation in a user-specific directory. ```shell # As root: curl -sSL https://raw.githubusercontent.com/soywod/himalaya/master/install.sh | sudo sh ``` ```shell # As a regular user: curl -sSL https://raw.githubusercontent.com/soywod/himalaya/master/install.sh | PREFIX=~/.local sh ``` -------------------------------- ### Enable and start systemd service Source: https://github.com/pimalaya/himalaya/wiki/Usage:real-time-notifications Commands to enable the systemd service to start on boot and manually start it. ```shell systemctl --user enable himalaya.service systemctl --user start himalaya.service ``` -------------------------------- ### Install Himalaya from AUR using Yay Source: https://github.com/pimalaya/himalaya/wiki/Installation:arch-linux If you use the `yay` AUR helper, this command simplifies the installation process from the AUR. ```shell yay -S himalaya-git ``` -------------------------------- ### Install Rust Development Environment Source: https://github.com/pimalaya/himalaya/wiki/Installation:sources Installs the Rust toolchain using the official installation script. Ensure you have curl installed. ```shell curl https://sh.rustup.rs -sSf | sh ``` -------------------------------- ### Install Himalaya CLI with script (as user) Source: https://github.com/pimalaya/himalaya/blob/master/README.md Installs the latest pre-built binary of Himalaya CLI to ~/.local using a script. Suitable for regular users. ```bash curl -sSL https://raw.githubusercontent.com/pimalaya/himalaya/master/install.sh | PREFIX=~/.local sh ``` -------------------------------- ### Install Himalaya CLI with script (as root) Source: https://github.com/pimalaya/himalaya/blob/master/README.md Installs the latest pre-built binary of Himalaya CLI using a script. Requires root privileges. ```bash curl -sSL https://raw.githubusercontent.com/pimalaya/himalaya/master/install.sh | sudo sh ``` -------------------------------- ### Install Himalaya Stable with Nix Source: https://github.com/pimalaya/himalaya/wiki/Installation:nix Installs the latest stable version of Himalaya from the Nix channels. ```shell nix-env -i himalaya ``` -------------------------------- ### TOML Folder Aliases Configuration Source: https://github.com/pimalaya/himalaya/wiki/Configuration Example of setting up folder aliases within an account's configuration. ```toml [account-name.folder-aliases] folder-1 = "alias-1" folder-2 = "alias-2" ``` -------------------------------- ### Install Himalaya CLI with Scoop Source: https://github.com/pimalaya/himalaya/blob/master/README.md Installs Himalaya CLI using the Scoop package manager on Windows. ```bash scoop install himalaya ``` -------------------------------- ### Install Himalaya from Git with Nix Source: https://github.com/pimalaya/himalaya/wiki/Installation:nix Installs Himalaya from a Git repository, either a specific archive or a local checkout. Use this for the latest development version. ```shell nix-env -if https://github.com/soywod/himalaya/archive/develop.tar.gz ``` ```shell nix-env -if . ``` -------------------------------- ### Install Himalaya from Nix Git Repository Source: https://github.com/pimalaya/himalaya/blob/master/README.md Install a potentially less stable but more up-to-date version of Himalaya directly from its master Git repository using Nix. ```bash nix-env -if https://github.com/pimalaya/himalaya/archive/master.tar.gz ``` -------------------------------- ### Install Himalaya from Source Tree Checkout (Nix) Source: https://github.com/pimalaya/himalaya/blob/master/README.md Install Himalaya from a local source tree checkout using Nix. Ensure you are in the root directory of the cloned repository. ```bash nix-env -if . ``` -------------------------------- ### Install Himalaya CLI with Cargo Source: https://github.com/pimalaya/himalaya/blob/master/README.md Installs Himalaya CLI using Cargo, enabling all default features. Ensure Rust and Cargo are installed. ```bash cargo install himalaya --locked ``` -------------------------------- ### Enable and Start Systemd Service Source: https://github.com/pimalaya/himalaya/wiki/Tips:new-msgs-counter Commands to enable and start the Himalaya watcher service, and view its status and logs. ```shell systemctl --user enable himalaya-watcher systemctl --user start himalaya-watcher # To see the logs: systemctl --user status himalaya-watcher journalctl --user -u himalaya-watcher -f ``` -------------------------------- ### Install Himalaya from Git Repository Source: https://github.com/pimalaya/himalaya/wiki/Installation:cargo Install the development version of Himalaya directly from its GitHub repository. This provides the most up-to-date code but may be less stable. ```shell cargo install --branch develop --git https://github.com/soywod/himalaya himalaya ``` -------------------------------- ### Install Himalaya with Nix Flakes Source: https://github.com/pimalaya/himalaya/wiki/Installation:nix Installs Himalaya using the Nix Flakes feature. This is an alternative to traditional Nix channels. ```shell nix profile install himalaya ``` ```shell nix profile install ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/pimalaya/himalaya/wiki/Installation:sources Clones the Himalaya repository from GitHub and navigates into the project directory. Cargo will handle dependency installation. ```shell git clone https://github.com/soywod/himalaya.git cd himalaya cargo check ``` -------------------------------- ### Install Himalaya CLI with Homebrew Source: https://github.com/pimalaya/himalaya/blob/master/README.md Installs Himalaya CLI using the Homebrew package manager on macOS or Linux. ```bash brew install himalaya ``` -------------------------------- ### Install Himalaya via Pacman Source: https://github.com/pimalaya/himalaya/wiki/Installation:arch-linux Use this command to install Himalaya if it's available in the Arch Linux community repository. ```shell pacman -S himalaya ``` -------------------------------- ### Install Himalaya from AUR using Git Source: https://github.com/pimalaya/himalaya/wiki/Installation:arch-linux Clone the Himalaya package from the AUR, then build and install it using makepkg. This method is useful if you prefer to build from source or if the package is not in the official repositories. ```shell git clone https://aur.archlinux.org/himalaya-git.git cd himalaya-git makepkg -isc ``` -------------------------------- ### List emails with pagination Source: https://github.com/pimalaya/himalaya/blob/master/README.md Example of listing emails from a specific account and folder, with pagination. ```bash himalaya envelope list --account posteo --folder Archives.FOSS --page 2 ``` -------------------------------- ### Install Himalaya with Cargo Source: https://github.com/pimalaya/himalaya/wiki/Installation:cargo Use this command to install the latest stable version of Himalaya from crates.io. ```shell cargo install himalaya ``` -------------------------------- ### Install Himalaya with Nix Flakes Source: https://github.com/pimalaya/himalaya/blob/master/README.md Install Himalaya using Nix Flakes. This command requires the Flakes feature to be enabled in your Nix configuration. ```bash nix profile install himalaya ``` -------------------------------- ### Install Himalaya on Fedora/CentOS/RHEL Source: https://github.com/pimalaya/himalaya/blob/master/README.md Use these commands to enable the COPR repository and install the Himalaya package on Fedora, CentOS, or RHEL systems. ```bash dnf copr enable atim/himalaya dnf install himalaya ``` -------------------------------- ### Configure Outlook with OAuth 2.0 Source: https://github.com/pimalaya/himalaya/blob/master/README.md Use this TOML configuration for Outlook accounts requiring OAuth 2.0 authentication. Ensure you have obtained your OAuth 2.0 credentials and follow the guide for setup. Running `himalaya account configure outlook` will prompt for your client secret. ```toml [accounts.outlook] email = "example@outlook.com" backend.type = "imap" backend.host = "outlook.office365.com" backend.port = 993 backend.login = "example@outlook.com" backend.auth.type = "oauth2" backend.auth.client-id = "*****" backend.auth.client-secret.keyring = "outlook-oauth2-client-secret" backend.auth.access-token.keyring = "outlook-oauth2-access-token" backend.auth.refresh-token.keyring = "outlook-oauth2-refresh-token" backend.auth.auth-url = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize" backend.auth.token-url = "https://login.microsoftonline.com/common/oauth2/v2.0/token" backend.auth.pkce = true backend.auth.scopes = ["https://outlook.office.com/IMAP.AccessAsUser.All", "https://outlook.office.com/SMTP.Send"] message.send.backend.type = "smtp" message.send.backend.host = "smtp.mail.outlook.com" message.send.backend.port = 587 message.send.backend.starttls = true message.send.backend.login = "example@outlook.com" message.send.backend.auth.type = "oauth2" message.send.backend.auth.client-id = "*****" message.send.backend.auth.client-secret.keyring = "outlook-oauth2-client-secret" message.send.backend.auth.access-token.keyring = "outlook-oauth2-access-token" message.send.backend.auth.refresh-token.keyring = "outlook-oauth2-refresh-token" message.send.backend.auth.auth-url = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize" message.send.backend.auth.token-url = "https://login.microsoftonline.com/common/oauth2/v2.0/token" message.send.backend.auth.pkce = true message.send.backend.auth.scopes = ["https://outlook.office.com/IMAP.AccessAsUser.All", "https://outlook.office.com/SMTP.Send"] ``` -------------------------------- ### Install Himalaya from Source Tree Checkout (Nix Flakes) Source: https://github.com/pimalaya/himalaya/blob/master/README.md Install Himalaya from a local source tree checkout using Nix Flakes. This command assumes you are in the repository's root directory. ```bash nix profile install ``` -------------------------------- ### Proton Mail Configuration (StartTLS) Source: https://github.com/pimalaya/himalaya/blob/master/README.md Example TOML configuration for connecting to Proton Mail using StartTLS encryption. This requires exporting the certificate generated by Proton Bridge and specifying its path. ```toml backend.encryption.type = "start-tls" backend.encryption.cert = "/path/to/exported/cert.pem" message.send.backend.encryption.type = "start-tls" message.send.backend.encryption.cert = "/path/to/exported/cert.pem" ``` -------------------------------- ### Full Outlook Account Configuration Source: https://github.com/pimalaya/himalaya/wiki/Configuration Example of a full configuration for an Outlook account, including IMAP and sendmail settings. ```toml email = "pdurant@outlook.com" email-listing-page-size = 25 signature = """ Regards, Paul DURANT Sent from Outlook """ sender = "sendmail" sendmail-cmd = "/usr/bin/msmtp" backend = "imap" imap-host = "outlook.office365.com" imap-port = 993 imap-login = "pdurant@outlook.com" imap-passwd-cmd = "security find-internet-password -gs outlook -w" ``` -------------------------------- ### Install Himalaya with Specific Features Source: https://github.com/pimalaya/himalaya/wiki/Installation:cargo Install Himalaya with only the Maildir backend enabled, disabling default features. This creates a smaller executable by including only necessary components. ```shell cargo install --no-default-features --features maildir-backend himalaya ``` -------------------------------- ### Install Himalaya CLI from Git with Cargo Source: https://github.com/pimalaya/himalaya/blob/master/README.md Installs the latest version of Himalaya CLI directly from its Git repository using Cargo. This may be less stable than releases. ```bash cargo install --locked --git https://github.com/pimalaya/himalaya.git ``` -------------------------------- ### Install Himalaya CLI with Cargo (IMAP only) Source: https://github.com/pimalaya/himalaya/blob/master/README.md Installs Himalaya CLI with only IMAP support, disabling default features and enabling the 'imap' feature. ```bash cargo install himalaya --locked --no-default-features --features imap ``` -------------------------------- ### TOML Signature Configuration Source: https://github.com/pimalaya/himalaya/wiki/Configuration Examples of how to configure the email signature in TOML, either by providing a direct string or a path to a signature file. ```toml signature = "~/.signature" ``` ```toml signature = """ Thank you, Regards, """ ``` -------------------------------- ### Full Posteo Local Maildir Configuration Source: https://github.com/pimalaya/himalaya/wiki/Configuration Example of a full configuration for a local Posteo account using the Maildir backend, including SMTP sender and custom mailbox aliases. ```toml email = "paul.durant@localhost" display-name = "Paul D." downloads-dir = "~/Downloads/posteo" backend = "maildir" maildir-root-dir = "~/Maildir" sender = "smtp" smtp-host = "posteo.de" smtp-port = 465 smtp-login = "paul.durant@posteo.com" smtp-passwd-cmd = "security find-internet-password -gs posteo -w" [posteo-local.mailboxes] sent = "Sent" # points to ~/Maildir/.Sent drafts = "~/Maildir/custom/drafts" ``` -------------------------------- ### Systemd Service for Himalaya Watcher Source: https://github.com/pimalaya/himalaya/wiki/Tips:new-msgs-counter Example systemd user service file to run `himalaya watch` as a background service. Ensure `ExecStart` points to your Himalaya executable. ```ini # ~/.config/systemd/user/himalaya-watcher.service [Unit] Description=Himalaya account watcher After=network.target [Service] ExecStart=/path/to/himalaya watch Environment=RUST_LOG=debug Restart=always RestartSec=10 [Install] WantedBy=default.target ``` -------------------------------- ### Start isync Synchronization Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Execute the mbsync command to initiate the synchronization process between the remote IMAP server and the local Maildir. ```shell mbsync posteo ``` -------------------------------- ### TOML Email Hooks Configuration Source: https://github.com/pimalaya/himalaya/wiki/Configuration Example of configuring shell commands to be executed at specific points in the email lifecycle, such as before sending. ```toml [account-name.email-hooks] pre-send = "process-markdown.sh" ``` -------------------------------- ### Run Himalaya Directly with Nix Source: https://github.com/pimalaya/himalaya/wiki/Installation:nix Executes the Himalaya command directly without a formal installation, using the Nix package manager. ```shell nix run himalaya ``` -------------------------------- ### Clone Repository and Check Dependencies Source: https://github.com/pimalaya/himalaya/blob/master/README.md Clone the Himalaya repository from GitHub and use Cargo to check project dependencies. This is part of the source installation process. ```bash git clone https://github.com/pimalaya/himalaya.git cd himalaya cargo check ``` -------------------------------- ### Download Attachments for an Email Source: https://github.com/pimalaya/himalaya/wiki/Usage:download-emails-attachments Use the `attachments` command followed by the email ID to download all attachments associated with that email. Ensure you have the Himalaya CLI installed and configured. ```shell $ himalaya attachments 42 ``` -------------------------------- ### Search Envelopes by Query Source: https://github.com/pimalaya/himalaya/wiki/Usage:list-envelopes Filter envelopes using the `search` command with a query. This example demonstrates searching for emails that are not seen and are from 'github'. The query syntax is based on RFC3501 for IMAP. ```shell himalaya search not seen from github ``` -------------------------------- ### Restart and Enable Dovecot Service Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Restart the Dovecot service to apply configuration changes and enable it to start automatically on system boot. ```shell sudo systemctl restart dovecot sudo systemctl enable dovecot ``` -------------------------------- ### Add Attachments with MML Source: https://github.com/pimalaya/himalaya/blob/master/README.md Examples of adding attachments and inline images to an email using MML. Specify the filename and optionally a custom name or disposition. ```eml From: alice@localhost To: bob@localhost Subject: How to attach stuff Regular binary attachment: <#part filename=/path/to/file.pdf> Custom file name: <#part filename=/path/to/file.pdf name=custom.pdf> Inline image: <#part disposition=inline filename=/path/to/image.png> ``` -------------------------------- ### Maildir Backend Configuration with Folder Aliases Source: https://github.com/pimalaya/himalaya/wiki/Configuration Demonstrates configuring the Maildir backend and setting up folder aliases that point to specific Maildir subdirectories. ```toml backend = "maildir" maildir-root-dir = "/my/maildir" [my-account.folder-aliases] inbox = "/my/maildir" sent = "/my/maildir/sent" ``` -------------------------------- ### Proton Mail Configuration (No TLS) Source: https://github.com/pimalaya/himalaya/blob/master/README.md Example TOML configuration for connecting to Proton Mail via its local IMAP and SMTP servers provided by Proton Bridge. SSL/TLS is deactivated, and a specific password generated by Proton Bridge is used. ```toml [accounts.proton] email = "example@proton.me" backend.type = "imap" backend.host = "127.0.0.1" backend.port = 1143 backend.encryption.type = "none" backend.login = "example@proton.me" backend.auth.type = "password" backend.auth.raw = "*****" message.send.backend.type = "smtp" message.send.backend.host = "127.0.0.1" message.send.backend.port = 1025 message.send.backend.encryption.type = "none" message.send.backend.login = "example@proton.me" message.send.backend.auth.type = "password" message.send.backend.auth.raw = "*****" ``` -------------------------------- ### Configure Notmuch Backend Source: https://github.com/pimalaya/himalaya/wiki/Configuration Set up the notmuch backend by specifying the database path and optionally defining custom folder aliases using Notmuch queries. ```toml backend = "notmuch" notmuch-db-path = "/my/notmuch" [my-account.folder-aliases] work = "tag:inbox and tag:work" ``` -------------------------------- ### Build Project Source: https://github.com/pimalaya/himalaya/blob/master/CONTRIBUTING.md Standard command to build the project. Features can be enabled or disabled using flags. ```text cargo build ``` -------------------------------- ### Configure Account Interactively Source: https://context7.com/pimalaya/himalaya/llms.txt Launches an interactive wizard to create or reconfigure a named account. Requires the `wizard` cargo feature. Settings are written to config.toml. ```sh himalaya account configure work ``` ```sh himalaya account configure ``` -------------------------------- ### List Configured Accounts Source: https://context7.com/pimalaya/himalaya/llms.txt Displays a table of all configured accounts, showing their name, backend, and default status. Supports limiting table width and JSON output. ```sh himalaya account list ``` ```sh himalaya account list --max-width 80 ``` ```sh himalaya --output json account list ``` -------------------------------- ### Global CLI Flags Source: https://context7.com/pimalaya/himalaya/llms.txt Demonstrates the use of global CLI flags available on all commands, including custom config files, account selection, JSON output, and logging control. ```sh # Use a custom config file (or multiple merged files) himalaya --config ~/.config/himalaya/work.toml envelope list HIMALAYA_CONFIG=~/.config/himalaya/personal.toml:~/.config/himalaya/secrets.toml himalaya envelope list ``` ```sh # Select a non-default account himalaya --account work envelope list himalaya -a posteo folder list ``` ```sh # JSON output himalaya --output json envelope list himalaya -o json message read 42 ``` ```sh # Logging control himalaya --quiet envelope list # suppress all logs himalaya --debug message send "..." # enable debug logs himalaya --trace folder expunge # verbose trace with backtrace ``` ```sh # Environment variable equivalents RUST_LOG=debug himalaya envelope list 2>/tmp/himalaya.log RUST_LOG=off himalaya --output json envelope list NO_COLOR=1 himalaya envelope list ``` -------------------------------- ### List Folders/Mailboxes Source: https://context7.com/pimalaya/himalaya/llms.txt Lists all folders available in the configured backend for the selected account. Supports specifying an account, limiting width, and JSON output. ```sh himalaya folder list ``` ```sh himalaya folder list --account personal ``` ```sh himalaya folder list --max-width 100 ``` ```sh himalaya --output json folder list ``` -------------------------------- ### Restart Himalaya Systemd User Service Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Restart the Himalaya user service to apply the new configuration. This command ensures that the service is reloaded and starts synchronizing emails. ```shell systemctl --user restart himalaya ``` -------------------------------- ### Create New Folder Source: https://context7.com/pimalaya/himalaya/llms.txt Creates a new folder (mailbox) in the backend. Supports specifying an account and has aliases `create` and `new`. ```sh himalaya folder add "Archives/2024" ``` ```sh himalaya folder add --account work "Projects/Acme" ``` ```sh himalaya folder create "Archive" ``` -------------------------------- ### Compose MML Email Source: https://github.com/pimalaya/himalaya/blob/master/README.md Example of composing an email using MML (MIME Meta Language) for a structured body with multiple parts. This compiles into a standard MIME message. ```eml From: alice@localhost To: bob@localhost Subject: MML simple <#multipart type=alternative> This is a plain text part. <#part type=text/enriched>
This is a centered enriched part
<#/multipart> ``` -------------------------------- ### Configure Dovecot Passwd-File Authentication Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Enable Dovecot's passwd-file driver for both password and user database lookups, pointing to the custom users file. ```cfg passdb { driver = passwd-file args = username_format=%u /etc/dovecot/users } userdb { driver = passwd-file args = username_format=%u /etc/dovecot/users } ``` -------------------------------- ### Send Email Template from File Source: https://github.com/pimalaya/himalaya/wiki/Usage:manage-templates Reads a template from standard input, compiles it into a MIME Message, and sends it using the configured sender for the selected account. ```shell cat ~/template.eml | himalaya template send ``` ```shell himalaya template send < ~/template.eml ``` -------------------------------- ### Build Release with Features Source: https://github.com/pimalaya/himalaya/blob/master/CONTRIBUTING.md Builds a release version of the project with specific features enabled and default features disabled. ```text cargo build --no-default-features --features imap,smtp,keyring --release ``` -------------------------------- ### Configure Outlook Account Source: https://github.com/pimalaya/himalaya/wiki/Configuration:outlook This TOML configuration sets up an Outlook account, specifying email credentials, IMAP and SMTP server details, and signature. ```toml display-name = "Paul DURANT" downloads-dir = "~/Downloads" [outlook] email = "p.durant@outlook.com" email-listing-page-size = 25 signature-delim = "~~ " signature = """ Regards, Paul DURANT Sent from Outlook """ backend = "imap" imap-host = "outlook.office365.com" imap-port = 993 imap-login = "p.durant@outlook.com" imap-passwd-cmd = "security find-internet-password -gs outlook -w" sender = "smtp" smtp-host = "smtp-mail.outlook.com" smtp-port = 587 smtp-starttls = true smtp-login = "p.durant@outlook.com" smtp-passwd-cmd = "security find-internet-password -gs outlook -w" ``` -------------------------------- ### Neovim Status Line Integration for New Messages Source: https://github.com/pimalaya/himalaya/wiki/Tips:new-msgs-counter Configures Neovim to display a new message count in the status line using `jobstart`. Handles output asynchronously. ```vim let s:counter = "" function HimalayaCounter() return s:counter == 0 ? '' : printf(' [📫 ×%d]', s:counter) endfunction function s:handle_counter(chan_id, data, name) let s:counter = +a:data endfunction augroup himalaya autocmd VimEnter * call jobstart('tail -fn 1 /tmp/himalaya-counter', {'on_stdout': function('s:handle_counter')}) augroup END ``` -------------------------------- ### Configure systemd service for Himalaya watcher Source: https://github.com/pimalaya/himalaya/wiki/Usage:real-time-notifications Set up a systemd user service to continuously run the `himalaya watch` command for real-time IMAP server monitoring. ```ini # ~/.config/systemd/user/himalaya.service [Unit] Description=Himalaya watcher After=network.target [Service] ExecStart=himalaya watch Restart=always RestartSec=10 [Install] WantedBy=default.target ``` -------------------------------- ### List Accounts with Max Width - Shell Source: https://github.com/pimalaya/himalaya/wiki/Usage:list-accounts Use the `-w` or `--max-width` option to specify the maximum width of the displayed table in pixels. This is useful for CLI clients to prevent table overflow. ```shell $ himalaya accounts -w 50 ``` -------------------------------- ### Build Himalaya in Release Mode Source: https://github.com/pimalaya/himalaya/wiki/Installation:sources Compiles the Himalaya project with optimizations enabled for release. Binaries will be placed in the target/release folder. ```shell cargo build --release ``` -------------------------------- ### Generate Dovecot Self-Signed Certificates Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Make the Dovecot mkcert.sh script executable and run it to generate self-signed SSL certificates for secure connections. ```shell sudo chmod +x /usr/share/doc/dovecot/mkcert.sh sudo /usr/share/doc/dovecot/mkcert.sh ``` -------------------------------- ### Enter Nix Development Shell Source: https://github.com/pimalaya/himalaya/wiki/Installation:nix Enters a development shell environment for working on Himalaya. This provides access to necessary development tools like the Rust compiler and Cargo. ```shell nix-shell ``` ```shell nix develop ``` -------------------------------- ### List Folders with Max Width - Shell Source: https://github.com/pimalaya/himalaya/wiki/Usage:list-folders Use this command to list folders and limit the table width to 50 pixels. This is useful for CLI clients to prevent overflow. ```shell $ himalaya folders -w 50 ``` -------------------------------- ### Configure systemd service for Himalaya notifier Source: https://github.com/pimalaya/himalaya/wiki/Usage:real-time-notifications Set up a systemd user service to run the `himalaya notify` command, triggering notifications for new emails. ```ini # ~/.config/systemd/user/himalaya.service [Unit] Description=Himalaya new messages notifier After=network.target [Service] ExecStart=himalaya notify Restart=always RestartSec=10 [Install] WantedBy=default.target ``` -------------------------------- ### Save Email Template from File Source: https://github.com/pimalaya/himalaya/wiki/Usage:manage-templates Reads a template from standard input, compiles it into a MIME Message, and saves it to a selected folder. ```shell cat ~/template.eml | himalaya --folder Archives template save ``` ```shell himalaya --folder Archives template save < ~/template.eml ``` -------------------------------- ### Proton Mail Configuration (System Keyring) Source: https://github.com/pimalaya/himalaya/blob/master/README.md Configure Himalaya to use the system's global keyring for storing the Proton Mail password. The 'proton-example' string should match the entry name in your keyring. ```toml backend.auth.keyring = "proton-example" ``` -------------------------------- ### Configure Dovecot Authentication Mechanisms Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Set the authentication mechanism to PLAIN and include the passwd-file authentication configuration for Dovecot. ```cfg auth_mechanisms = plain !include auth-passwdfile.conf.ext ``` -------------------------------- ### LunarVim Status Line Integration with fwatch.nvim Source: https://github.com/pimalaya/himalaya/wiki/Tips:new-msgs-counter Sets up LunarVim to display a new message count using the fwatch.nvim library for file watching. Requires fwatch.nvim plugin. ```lua lvim.plugins = { ... { 'rktjmp/fwatch.nvim', }, ... } -- himalaya local email_num = 0 local function himalayacounter() local handle = io.popen("tail -n 1 /tmp/himalaya-counter") if handle then local result = handle:read("*a") return result end end local function himalaya_status() local res = "" email_num = himalayacounter() res = string.format('📫 %d', email_num) return res end local components = require("lvim.core.lualine.components") lvim.builtin.lualine.sections.lualine_c = { himalaya_status } local fwatch = require('fwatch') fwatch.watch("/tmp/himalaya-counter", { on_event = function() email_num = himalayacounter() end } ``` -------------------------------- ### Configure Dovecot Mailbox Subscriptions Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Set up automatic subscription and special folder assignments for common mailboxes like Drafts, Sent, Archives, Trash, and Junk within Dovecot. ```cfg namespace inbox { mailbox Drafts { auto = subscribe special_use = \Drafts } mailbox Sent { auto = subscribe special_use = \Sent } mailbox Archives { auto = subscribe special_use = \Archive } mailbox Trash { auto = subscribe special_use = \Trash } mailbox Junk { auto = subscribe special_use = \Junk } } ``` -------------------------------- ### Generate Man Pages with Himalaya CLI Source: https://github.com/pimalaya/himalaya/wiki/Usage:man Use this command to generate man pages for all subcommands in a given directory. Ensure the directory path is correct. ```shell $ himalaya man /usr/share/man/man1/ ``` -------------------------------- ### Configure Himalaya TOML Settings Source: https://context7.com/pimalaya/himalaya/llms.txt This TOML file configures global defaults, account-specific settings, folder aliases, display options, message handling, and backend connections for Himalaya CLI. ```toml # ~/.config/himalaya/config.toml # Global defaults (apply to all accounts) display-name = "Alice" signature = "Regards,\nAlice" signature-delim = "-- \n" downloads-dir = "~/Downloads" [accounts.personal] default = true email = "alice@example.com" display-name = "Alice" signature = "Cheers,\nAlice" # Folder aliases (inbox, sent, drafts, trash are special) folder.aliases.inbox = "INBOX" folder.aliases.sent = "Sent" folder.aliases.drafts = "Drafts" folder.aliases.trash = "Trash" # Envelope listing display options envelope.list.page-size = 20 envelope.list.datetime-fmt = "%F %R%:z" envelope.list.datetime-local-tz = true envelope.list.table.unseen-char = "*" envelope.list.table.replied-char = "R" envelope.list.table.flagged-char = "!" envelope.list.table.attachment-char = "@" # Message read/write defaults message.read.headers = ["From", "To", "Cc", "Subject"] message.read.format = "auto" # "flowed" | "fixed" | "auto" message.write.headers = ["From", "To", "In-Reply-To", "Cc", "Subject"] message.send.save-copy = true message.delete.style = "folder" # "folder" (move to Trash) | "flag" # Template composition styles template.new.signature-style = "inlined" # "inlined" | "attached" | "hidden" template.reply.posting-style = "top" # "top" | "bottom" | "interleaved" template.reply.signature-style = "below-quote" template.reply.quote-headline-fmt = "On %d/%m/%Y %H:%M, {senders} wrote:\n" template.forward.posting-style = "top" template.forward.quote-headline = "-------- Forwarded Message --------\n" # IMAP backend (reading) backend.type = "imap" backend.host = "imap.example.com" backend.port = 993 backend.encryption.type = "tls" # "tls" | "start-tls" | "none" backend.login = "alice@example.com" backend.auth.type = "password" backend.auth.cmd = "pass show personal-imap" # or .raw / .keyring # SMTP backend (sending) message.send.backend.type = "smtp" message.send.backend.host = "smtp.example.com" message.send.backend.port = 587 message.send.backend.encryption.type = "start-tls" message.send.backend.login = "alice@example.com" message.send.backend.auth.type = "password" message.send.backend.auth.cmd = "pass show personal-smtp" # --- OAuth 2.0 example (Gmail) --- # backend.auth.type = "oauth2" # backend.auth.method = "xoauth2" # backend.auth.client-id = "YOUR_CLIENT_ID" # backend.auth.client-secret.keyring = "gmail-oauth2-client-secret" # backend.auth.access-token.keyring = "gmail-oauth2-access-token" # backend.auth.refresh-token.keyring = "gmail-oauth2-refresh-token" # backend.auth.auth-url = "https://accounts.google.com/o/oauth2/v2/auth" # backend.auth.token-url = "https://www.googleapis.com/oauth2/v3/token" # backend.auth.pkce = true # backend.auth.scope = "https://mail.google.com/" # --- Maildir backend --- # backend.type = "maildir" # backend.root-dir = "~/.Mail/personal" # --- Notmuch backend --- # backend.type = "notmuch" # backend.db-path = "~/.Mail" # --- Sendmail sending backend --- ``` -------------------------------- ### Configure Gmail with OAuth 2.0 Source: https://github.com/pimalaya/himalaya/blob/master/README.md This TOML configuration enables secure OAuth 2.0 authentication for Gmail. It requires the `oauth2` and `keyring` cargo features and involves obtaining credentials from the Google Cloud Console. ```toml [accounts.gmail] email = "example@gmail.com" folder.aliases.inbox = "INBOX" folder.aliases.sent = "[Gmail]/Sent Mail" folder.aliases.drafts = "[Gmail]/Drafts" folder.aliases.trash = "[Gmail]/Trash" backend.type = "imap" backend.host = "imap.gmail.com" backend.port = 993 backend.login = "example@gmail.com" backend.auth.type = "oauth2" backend.auth.method = "xoauth2" backend.auth.client-id = "*****" backend.auth.client-secret.keyring = "gmail-oauth2-client-secret" backend.auth.access-token.keyring = "gmail-oauth2-access-token" backend.auth.refresh-token.keyring = "gmail-oauth2-refresh-token" backend.auth.auth-url = "https://accounts.google.com/o/oauth2/v2/auth" backend.auth.token-url = "https://www.googleapis.com/oauth2/v3/token" backend.auth.pkce = true backend.auth.scope = "https://mail.google.com/" message.send.backend.type = "smtp" message.send.backend.host = "smtp.gmail.com" message.send.backend.port = 465 message.send.backend.login = "example@gmail.com" message.send.backend.auth.type = "oauth2" message.send.backend.auth.method = "xoauth2" message.send.backend.auth.client-id = "*****" message.send.backend.auth.client-secret.keyring = "gmail-oauth2-client-secret" message.send.backend.auth.access-token.keyring = "gmail-oauth2-access-token" message.send.backend.auth.refresh-token.keyring = "gmail-oauth2-refresh-token" message.send.backend.auth.auth-url = "https://accounts.google.com/o/oauth2/v2/auth" message.send.backend.auth.token-url = "https://www.googleapis.com/oauth2/v3/token" message.send.backend.auth.pkce = true message.send.backend.auth.scope = "https://mail.google.com/" ``` -------------------------------- ### Generate Dovecot User Password Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Create a password hash for a virtual user using the doveadm pw command with the CRYPT algorithm. ```shell doveadm pw -s CRYPT ``` -------------------------------- ### Configure SMTP Sender Source: https://github.com/pimalaya/himalaya/wiki/Configuration Configure the SMTP sender by providing host, port, login credentials, and SSL/STARTTLS options. The password can be retrieved via a shell command. ```toml sender = "smtp" smtp-host = "smtp.gmail.com" smtp-port = 465 smtp-login = "p.durant@gmail.com" smtp-passwd-cmd = "pass show gmail" ``` -------------------------------- ### Generate New Email Template Source: https://github.com/pimalaya/himalaya/wiki/Usage:manage-templates Generates a template for writing a new email. The template builds the 'From' and signature from your configuration. ```shell himalaya template new ``` -------------------------------- ### Configure isync for Maildir Synchronization Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Set up isync to synchronize IMAP accounts with a local Maildir. This configuration defines IMAP accounts, local Maildir stores, and the synchronization channel. ```cfg IMAPAccount posteo Host posteo.de User clement.douin@posteo.net PassCmd "pass show posteo" SSLType IMAPS IMAPStore posteo-remote Account posteo MaildirStore posteo-local SubFolders Verbatim Path ~/.local/share/mail/clement.douin@posteo.net/ Inbox ~/.local/share/mail/clement.douin@posteo.net/INBOX Channel personal-posteo Far :posteo-remote: Near :posteo-local: Patterns * SyncState * Create Both ``` -------------------------------- ### Update Rust Toolchain Source: https://github.com/pimalaya/himalaya/blob/master/CONTRIBUTING.md Use this command to update your Rust toolchain if you are not using Nix. ```text rustup update ``` -------------------------------- ### Configure Gmail Account in TOML Source: https://github.com/pimalaya/himalaya/wiki/Configuration:gmail This TOML configuration sets up a Gmail account with IMAP and SMTP backends. It requires an app-specific password generated from your Google account, not your regular password. Ensure 2-step verification is enabled on your Google account to generate app passwords. ```toml display-name = "Paul DURANT" downloads-dir = "~/Downloads" signature = "Cordialement,\nPaul DURANT" email-listing-page-size = 50 [gmail] default = true email = "p.durant@gmail.com" backend = "imap" imap-host = "imap.gmail.com" imap-port = 993 imap-login = "p.durant@gmail.com" imap-passwd-cmd = "pass show gmail" sender = "smtp" smtp-host = "smtp.gmail.com" smtp-port = 465 smtp-login = "p.durant@gmail.com" smtp-passwd-cmd = "pass show gmail" [gmail.folder-aliases] sent = "[Gmail]/Sent Mail" drafts = "[Gmail]/Drafts" ``` -------------------------------- ### Forward an email with himalaya Source: https://context7.com/pimalaya/himalaya/llms.txt Fetches a message by envelope ID, pre-fills a forward template, and opens `$EDITOR`. Supports specifying a folder/account and pre-filling headers. Aliases `fwd` and `fd` are available. ```sh himalaya message forward 42 ``` ```sh himalaya message forward --folder Sent --account personal 15 ``` ```sh himalaya message forward --header "To: charlie@example.com" 42 ``` ```sh # Aliases: fwd, fd himalaya message fwd 42 ``` -------------------------------- ### List Envelopes with Custom Page Number Source: https://github.com/pimalaya/himalaya/wiki/Usage:list-envelopes Use the `-p` or `--page` option to specify which page of results to display. Defaults to the first page. ```shell $ himalaya list -p 5 ``` -------------------------------- ### Add User to Dovecot Users Database Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Define a user entry in Dovecot's user database file, specifying username, password hash, user/group IDs, and home directory. ```cfg clement.douin@posteo.net:{CRYPT}$2y$05$AgvlJKRxgpYfNumFuaOnjOUHfU5DtaDeHK/77Tk16Pngk06phoBPu:soywod:soywod::/home/soywod:: ``` -------------------------------- ### Autocomplete UIDs with jq and fzf Source: https://github.com/pimalaya/himalaya/wiki/Tips:autocomplete-uids-jq-fzf Use this command to pipe `himalaya`'s JSON output to `jq` to extract UIDs, then pipe that to `fzf` for interactive selection. ```shell himalaya -o json list | jq '.response[].uid' | fzf ``` -------------------------------- ### TOML Configuration Structure Source: https://github.com/pimalaya/himalaya/wiki/Configuration The basic structure of a Himalaya TOML configuration file, including global settings and account-specific sections. ```toml global-config [account-name-1] account-config-1 [account-name-2] account-config-2 … ``` -------------------------------- ### Generate Shell Completion Scripts Source: https://context7.com/pimalaya/himalaya/llms.txt Generates shell completion scripts for various shells (Bash, Zsh, Fish, PowerShell, Elvish) and prints them to stdout. ```sh # Bash himalaya completion bash > ~/.bash_completion.d/himalaya ``` ```sh # Zsh himalaya completion zsh > ~/.zfunc/_himalaya ``` ```sh # Fish himalaya completion fish > ~/.config/fish/completions/himalaya.fish ``` ```sh # PowerShell himalaya completion powershell > himalaya.ps1 ``` ```sh # Elvish himalaya completion elvish ``` -------------------------------- ### Generate Man Pages Source: https://context7.com/pimalaya/himalaya/llms.txt Generates man pages for all Himalaya CLI commands and writes them to a specified directory. ```sh himalaya manual /usr/local/share/man/man1/ ``` -------------------------------- ### Generate New Message Template Source: https://context7.com/pimalaya/himalaya/llms.txt Outputs a prefilled MML template for a new message to stdout, including From header and signature. Can pre-fill other headers like To and Subject. ```sh himalaya template write ``` ```sh # Pre-fill headers himalaya template write --header "To: bob@example.com" --header "Subject: Hello" ``` -------------------------------- ### List and Search Envelopes Source: https://context7.com/pimalaya/himalaya/llms.txt Lists message summaries with filtering and sorting using a rich query language. Supports pagination, account selection, and JSON output for scripting. ```sh himalaya envelope list ``` ```sh himalaya envelope list --folder "Archives/FOSS" --page 2 --page-size 50 ``` ```sh himalaya envelope list --account posteo ``` ```sh himalaya envelope list flag unseen and from alice ``` ```sh himalaya envelope list subject project order by date desc ``` ```sh himalaya envelope list "subject foo and body bar order by date desc subject asc" ``` ```sh himalaya --output json envelope list | jq '.[] | select(.flags | contains(["unseen"]))' ``` -------------------------------- ### Download Attachments Source: https://context7.com/pimalaya/himalaya/llms.txt Command to download attachments from specified messages. ```sh himalaya attachments download 42 ``` -------------------------------- ### Diagnose Account Connectivity Source: https://context7.com/pimalaya/himalaya/llms.txt Checks backend connectivity and configuration for a given account. Can target a specific account or the default. ```sh himalaya account doctor ``` ```sh himalaya account doctor --account work ``` -------------------------------- ### Compile and Send MML Template Source: https://context7.com/pimalaya/himalaya/llms.txt Compiles an MML template into a MIME message, sends it, and saves a copy to the sent folder. Supports attachments, stdin input, and multipart templates. ```sh # Send an MML template with an attachment himalaya template send "From: alice@example.com To: bob@example.com Subject: Sending a file Here is the file you requested: <#part filename=/path/to/report.pdf><#/part>" ``` ```sh # From stdin cat my-template.mml | himalaya template send ``` ```sh # Multipart MML template himalaya template send "$(cat <<'EOF' From: alice@example.com To: bob@example.com Subject: Multipart example <#multipart type=alternative> Plain text version. <#part type=text/html> HTML version. <#/multipart> EOF )" ``` -------------------------------- ### Secure Gmail Password with System Keyring Source: https://github.com/pimalaya/himalaya/blob/master/README.md Leverage your system's global keyring for password storage by specifying a keyring name. This requires the `keyring` cargo feature and is a secure method for managing credentials. ```toml backend.auth.keyring = "gmail-example" ``` -------------------------------- ### Configure Himalaya for Local and Remote IMAP Source: https://github.com/pimalaya/himalaya/wiki/Tips:offline-with-isync-dovecot Set up Himalaya client configuration with two accounts: one for the local Dovecot IMAP server and another for the remote IMAP server for notifications. ```toml # ~/.config/himalaya/config.toml name = "Clément DOUIN" downloads-dir = "/home/soywod/Downloads" watch-cmds = ["mbsync posteo"] [posteo] default = true email = "clement.douin@posteo.net" imap-host = "localhost" imap-port = 993 imap-insecure = true # This is necessary for our self-signed cert imap-login = "clement.douin@posteo.net" imap-passwd-cmd = "pass show posteo" smtp-host = "posteo.de" smtp-port = 465 smtp-login = "clement.douin@posteo.net" smtp-passwd-cmd = "pass show posteo" [posteo-idle] email = "clement.douin@posteo.net" imap-host = "posteo.de" imap-port = 993 imap-login = "clement.douin@posteo.net" imap-passwd-cmd = "pass show posteo" smtp-host = "posteo.de" smtp-port = 465 smtp-login = "clement.douin@posteo.net" smtp-passwd-cmd = "pass show posteo" ``` -------------------------------- ### Generate Fish Shell Completion Script Source: https://github.com/pimalaya/himalaya/wiki/Usage:completion This command generates the completion script for the fish shell and saves it to the appropriate directory for automatic loading. ```shell $ himalaya completion fish > ~/.config/fish/completions/himalaya.fish ``` -------------------------------- ### Vim Status Line Integration for New Messages Source: https://github.com/pimalaya/himalaya/wiki/Tips:new-msgs-counter Configures Vim to display a new message count in the status line by running `tail` in a job. Handles output asynchronously. ```vim let s:counter = "" function HimalayaCounter() return s:counter == 0 ? '' : printf(' [📫 ×%d]', s:counter) endfunction function s:handle_counter(chan_id, data) let s:counter = +a:data endfunction augroup himalaya autocmd VimEnter * call job_start(['/bin/sh', '-c', 'tail -fn 1 /tmp/himalaya-counter'], {'in_mode': 'nl', 'out_mode: 'nl', 'out_cb': function('s:handle_counter')}) augroup END ``` -------------------------------- ### Fish Shell UID Completion Source: https://github.com/pimalaya/himalaya/wiki/Tips:autocomplete-uids-jq-fzf Configure Fish shell to provide autocompletion for `himalaya` commands that accept UIDs. This snippet defines completions for commands like copy, delete, read, and reply. ```fish complete -k -f -c himalaya -n "__fish_seen_subcommand_from copy c delete d read r reply" -a "(himalaya -o json list | jq -r '.response[]| [.uid, .sender + \" ✹ \" + .subject]|@tsv')" ``` -------------------------------- ### Override Multiple Local Dependencies Source: https://github.com/pimalaya/himalaya/blob/master/CONTRIBUTING.md When encountering version conflicts, override multiple sub-dependencies to point to local paths. This ensures consistency when working with a fork or local changes in related crates. ```toml [patch.crates-io] email-lib.path = "/path/to/core/email" imap-client.path = "/path/to/imap-client" keyring-lib.path = "/path/to/core/keyring" mml-lib.path = "/path/to/core/mml" oauth-lib.path = "/path/to/core/oauth" pgp-lib.path = "/path/to/core/pgp" pimalaya-tui.path = "/path/to/tui" process-lib.path = "/path/to/core/process" secret-lib.path = "/path/to/core/secret" ``` -------------------------------- ### Generate Reply Email Template Source: https://github.com/pimalaya/himalaya/wiki/Usage:manage-templates Generates a template for replying to an email. Includes all recipients and Cc addresses if the '-a' option is used. ```shell himalaya template reply -a 42 ``` -------------------------------- ### Save Raw Email to Folder using Himalaya Source: https://github.com/pimalaya/himalaya/wiki/Usage:save-send-emails Reads a raw email from standard input and saves it to the specified folder. Ensure the email file is piped or redirected to the command. ```shell $ cat ~/email.eml | himalaya --folder Archives save ``` ```shell $ himalaya --folder Archives save < ~/email.eml ``` -------------------------------- ### Fish Shell UID Completion with Flags Source: https://github.com/pimalaya/himalaya/wiki/Tips:autocomplete-uids-jq-fzf An advanced Fish shell completion for `himalaya` that includes message flags (Seen, Answered) along with UID, sender, and subject. It also allows specifying the number of messages to list. ```fish complete -k -f -c himalaya -n "__fish_seen_subcommand_from copy delete d read r reply" -a "(himalaya -o json list --size 40 | jq -r 'def fl($k): def seen($k): if $k|index(\"Seen\") then \" \" else \"s \" end; def answered($k): if $k|index(\"Answered\") then \"a \" else \" \" end; seen($k)+answered($k); .response[]| [.uid, fl(.flags)+.sender+\" ✹ \"+.subject]|@tsv')" ``` -------------------------------- ### Add Custom Headers When Reading Email Source: https://github.com/pimalaya/himalaya/wiki/Usage:read-emails Use the `-H` or `--header` option to prepend custom headers to the email being read. These are merged with configured headers. ```shell $ himalaya read -H From -H To 42 ``` -------------------------------- ### List Envelopes with Custom Page Size Source: https://github.com/pimalaya/himalaya/wiki/Usage:list-envelopes Use the `-s` or `--page-size` option to specify the number of envelopes to display per page. This overrides the default pagination size. ```shell $ himalaya list -s 50 ```