Skip to content

Neovim Plugin

rustmail.nvim is a Neovim client that connects to a running RustMail instance, providing a floating-window UI for browsing captured emails. New messages appear automatically via background polling.

Requirements

  • Neovim >= 0.10
  • curl on PATH
  • rustmail binary on PATH (or configure a custom path)

Installation

lua
{
  "rustmailapp/rustmail.nvim",
  cmd = "RustMail",
  opts = {},
}
lua
use {
  "rustmailapp/rustmail.nvim",
  config = function()
    require("rustmail").setup()
  end,
}

Configuration

Pass options to require("rustmail").setup():

lua
require("rustmail").setup({
  host = "127.0.0.1",        -- RustMail server host
  port = 8025,               -- RustMail HTTP port
  smtp_port = 1025,          -- RustMail SMTP port (used by auto_start)
  auto_start = false,        -- start RustMail daemon if not already running
  binary = "rustmail",       -- path to rustmail binary
  poll_interval = 2000,      -- polling interval in ms
  float = {
    width = 0.8,             -- fraction of editor width
    height = 0.8,            -- fraction of editor height
    border = "rounded",      -- border style
  },
  keymaps = {
    list = {
      open = "<CR>",
      delete = "dd",
      toggle_read = "mr",
      toggle_star = "ms",
      refresh = "R",
      search = "/",
      quit = "q",
      clear_all = "D",
    },
    detail = {
      back = "<BS>",
      delete = "dd",
      toggle_read = "mr",
      toggle_star = "ms",
      quit = "q",
      view_raw = "gR",
      view_attachments = "ga",
      view_auth = "gA",
    },
  },
})

Auto-Start

When auto_start = true, the plugin performs a health check on startup. If RustMail is not reachable, it spawns a detached rustmail serve process with the configured ports. Stop it with :RustMail stop.

Commands

CommandDescription
:RustMailOpen the message list (default)
:RustMail toggleToggle the message list
:RustMail closeClose all windows and stop polling
:RustMail stopStop the auto-started daemon

Keymaps

All keymaps are buffer-local to RustMail windows and fully configurable via the keymaps option.

INFO

dd shadows Vim's built-in delete-line in RustMail buffers.

Message List

KeyAction
<CR>Open selected message
ddDelete selected message
mrToggle read/unread
msToggle starred
RRefresh list
/Search messages (empty input clears search)
DDelete ALL messages (with confirmation)
qClose

Message Detail

KeyAction
<BS>Back to list
ddDelete message
mrToggle read/unread
msToggle starred
gRView raw message (RFC 5322)
gaView attachments
gAView authentication results (DKIM/SPF/DMARC)
qClose

Lua API

lua
local rustmail = require("rustmail")

rustmail.setup({ ... })      -- configure the plugin
rustmail.open()              -- open the message list
rustmail.close()             -- close all windows, stop polling
rustmail.toggle()            -- toggle the message list
rustmail.ensure_daemon()     -- start rustmail if not running
rustmail.stop_daemon()       -- stop auto-started daemon

Released under the MIT / Apache 2.0 License.