simplemailclient 0.1.1

A simple terminal mail client (SMTP send, IMAP fetch) with a TUI.
# simplemailclient

A small terminal mail client written in Rust. It sends mail over SMTP, fetches
over IMAP, and gives you a split-pane TUI for reading, replying, and composing.

The installed binary is named **`mailrs`** (avoids clashing with the standard
Unix `mail` command).

## Features

- **TUI inbox** — folders (Inbox / Sent / Starred / Trash), a message list, and
  a reading pane, navigable with `Tab` / arrow keys and `j` / `k`.
- **Compose & reply** in-app: To and Body fields, `Ctrl+S` to send, `Esc` to
  cancel.
- **Real trash** — pressing `d` moves the message locally *and* copies it to
  the configured trash folder on the IMAP server, then expunges it from the
  inbox so it never comes back on re-sync.
- **Deduplication** — messages are keyed by their RFC 2822 `Message-ID`; a
  message you've already seen is never re-delivered on sync.
- **Auto-sync** every 10 seconds while idle, plus on-demand sync with `S`.
  Fetches up to the last 50 messages tagged `[mailrs_mail]`.
- **Contacts** auto-collected from mail you send and receive, referenced by a
  stable numeric ID (use the ID in the To field to address people quickly).

## Install

```sh
cargo install simplemailclient
```

## Configuration

On first run a starter config is written to your config directory
(`~/.config/mail-rs/config.toml` on Linux/macOS,
`%APPDATA%\mail-rs\config.toml` on Windows). Fill in your SMTP/IMAP details:

```toml
identity     = "you@gmail.com"
display_name = "Your Name"
domain       = "gmail.com"

[smtp]
host     = "smtp.gmail.com"
port     = 587
username = "you@gmail.com"
password = "your-app-password"   # use an App Password, not your login password
tls      = true

[imap]
host          = "imap.gmail.com"
port          = 993
username      = "you@gmail.com"
password      = "your-app-password"
tls           = true
inbox_folder  = "INBOX"
trash_folder  = "[Gmail]/Trash"  # Gmail; other providers: "Trash" or "Deleted"
```

> **Gmail users**: `trash_folder` must be `[Gmail]/Trash`.  
> **Other providers**: try `Trash` (the default) or `Deleted`.

## Usage

```sh
mailrs                      # launch the interactive TUI
mailrs send <username|id>   # compose and send from the command line
mailrs inbox                # list inbox messages
mailrs read <index>         # read a message by index
mailrs sync                 # fetch new mail via IMAP
```

### TUI keys

| Key             | Action                    |
| --------------- | ------------------------- |
| `Tab` / `←→`    | Move focus between panes  |
| `↑↓` / `j` `k`  | Navigate within a pane    |
| `Enter`         | Open selected message     |
| `c`             | Compose new message       |
| `r`             | Reply to the open message |
| `s`             | Star / unstar             |
| `d`             | Move to trash (local + IMAP server) |
| `S`             | Sync now                  |
| `?`             | Toggle contacts panel     |
| `q`             | Quit                      |

In the compose modal, `Tab` cycles between the **To** and **Body** fields.
`Enter` in the To field jumps straight to the body. `Ctrl+S` sends; `Esc`
cancels.

## Data

Mail and contacts are stored locally:

| Platform | Path |
| -------- | ---- |
| Linux / macOS | `~/.local/share/mail-rs/mailbox.json` |
| Windows | `%LOCALAPPDATA%\mail-rs\mailbox.json` |

Configuration lives in:

| Platform | Path |
| -------- | ---- |
| Linux / macOS | `~/.config/mail-rs/config.toml` |
| Windows | `%APPDATA%\mail-rs\config.toml` |

## License

[MIT](LICENSE)