Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [Unreleased]

### Added

- **HTML email body**: `--html-body` (inline) and `--html-file` (from file) flags on send, reply, and forward. JMAP assembles multipart/alternative automatically when both text and HTML are provided.
- **File attachments**: `--attachment` / `-a` flag (repeatable) on send, reply, and forward. Files are uploaded as blobs and attached via JMAP's `bodyStructure` with proper multipart/mixed MIME tree.
- **`upload_blob` JMAP method**: POST raw bytes to Fastmail's upload endpoint, returns a `blobId` for use in email composition.
- **GraphQL `html_body` parameter**: `sendEmail`, `replyToEmail`, and `forwardEmail` mutations accept optional HTML body content. Previews indicate when HTML is included.

### Changed

- **Refactored body construction**: `create_and_submit_email` now handles plain text, text+HTML (multipart/alternative), and attachments (multipart/mixed with nested alternative) in a single code path. Eliminated duplicated body/cc/bcc logic across compose methods.
- `bodyValues` keys changed from `"body"` to `"textBody"` / `"htmlBody"` for clarity.
- `mime_from_filename` in util.rs is now public (used by `load_attachment`).

## [2.0.1] - 2026-03-26

### Fixed
Expand Down
80 changes: 80 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ tracing = "0.1.44"
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
roxmltree = "0.21.1"

[dev-dependencies]
tempfile = "3"
wiremock = "0.6"

[profile.release]
strip = true
lto = true
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CLI for Fastmail's JMAP API. Read, search, send, and manage emails from your ter

| Feature | Description |
| --------------------- | ---------------------------------------------------------------------- |
| **Email** | List, search, read, send, reply, forward, threads, identity selection |
| **Email** | List, search, read, send, reply, forward, threads, identity selection, HTML bodies, file attachments |
| **Mailboxes** | List folders, move emails, mark spam/read |
| **Contacts** | Search contacts via CardDAV |
| **Attachments** | Download files, extract text, resize images |
Expand Down Expand Up @@ -158,6 +158,26 @@ fastmail-cli send \
--from "alias@yourdomain.com" \
--subject "Hello" \
--body "Message"

# HTML email body (inline or from file)
fastmail-cli send \
--to "alice@example.com" \
--subject "Newsletter" \
--body "Plain text fallback" \
--html-body "<h1>Hello</h1><p>Rich content here</p>"

fastmail-cli send \
--to "alice@example.com" \
--subject "Report" \
--body "See attached" \
--html-file ./email.html

# File attachments (repeatable)
fastmail-cli send \
--to "alice@example.com" \
--subject "Documents" \
--body "Please review" \
-a report.pdf -a data.xlsx
```

### Move Email
Expand Down
Loading
Loading