NuGet package
.NET CLI
A native .NET global tool for managing email accounts, sending messages, creating scoped API tokens, and automating workflows. Rich terminal output with Spectre.Console.
Quick start
# Install
dotnet tool install --global inbox-api-cli
# Configure your API token
mail-cli configure --api-token cw_your_token
# List your email accounts
mail-cli accounts list
# Read your latest unread messages
mail-cli messages list --unread
# Send an email
mail-cli send --account <id> --to "bob@example.com" --subject "Hello" --body "Hi Bob!"
# Search across all accounts
mail-cli search "invoice Q3" Node.js CLI vs .NET CLI
Both CLIs provide the same core functionality. Choose based on your environment:
@inbox-api/cli (Node.js)
- Requires Node.js 18+
- Install via npm
- Address parsing: "Name <email>"
inbox-api-cli (.NET)
- Requires .NET 9 runtime
- Install via dotnet tool
- Short ID prefix matching
- Rich Spectre.Console output
Installation
Install as a .NET global tool:
dotnet tool install --global inbox-api-cli
Verify the installation:
mail-cli --help
Requirements: .NET 9 runtime or SDK
Authentication
The .NET CLI authenticates using API tokens (prefixed with cw_).
Three ways to provide credentials, checked in order:
# 1. CLI flags (highest priority)
mail-cli accounts list --api-token cw_your_token --api-url https://api.example.com
# 2. Environment variables
export CLOUDWORKS_API_TOKEN=cw_your_token
export CLOUDWORKS_API_URL=https://api.example.com
# 3. Config file (saved by 'configure' command)
mail-cli configure
Saves credentials to ~/.cloudworks/config.json.
Global Options
Available on every command:
--json Output as JSON
--no-color Disable colored output
--debug Show debug information
configure
Set up API connection. Tests the connection before saving.
mail-cli configure
mail-cli configure --api-url https://api.example.com --api-token cw_your_token
Options:
--api-url <url> API base URL (default: http://localhost:5015)
--api-token <token> API token
accounts list
List all connected email accounts.
mail-cli accounts list
┌──────────────────────┬─────────────────────┬──────────────┬────────────┬──────────┐
│ ID │ Email │ Display Name │ Sync │ Messages │
├──────────────────────┼─────────────────────┼──────────────┼────────────┼──────────┤
│ a1b2c3d4-... │ me@gmail.com │ Personal │ Synced │ 1,247 │
│ e5f6g7h8-... │ work@company.com │ Work │ Syncing... │ 3,891 │
└──────────────────────┴─────────────────────┴──────────────┴────────────┴──────────┘
accounts add
Connect a new email account via IMAP/SMTP.
mail-cli accounts add \
--email "me@company.com" \
--imap-host "imap.company.com" \
--smtp-host "smtp.company.com" \
--password "app-password"
Options:
--email <email> Email address (required)
--imap-host <host> IMAP server hostname (required)
--smtp-host <host> SMTP server hostname (required)
--display-name <name> Display name
--imap-port <port> IMAP port (default: 993)
--smtp-port <port> SMTP port (default: 587)
--no-ssl Disable SSL for both IMAP and SMTP
--password <password> Account password
accounts remove
Disconnect and remove an email account. Supports short ID prefix matching.
mail-cli accounts remove <account-id>
mail-cli accounts remove <account-id> --force # skip confirmation
# Short ID matching — just type the first few characters
mail-cli accounts remove a1b2c3
messages list
List messages with filtering and pagination.
mail-cli messages list
mail-cli messages list --account <id> --unread
mail-cli messages list --page 2 --page-size 50
Options:
--account <id> Filter by account
--folder <id> Filter by folder
--unread Show only unread messages
--start-date <date> Filter from date
--end-date <date> Filter to date
--page <n> Page number (default: 1)
--page-size <n> Results per page (default: 50, max: 100)
messages get
Get message details, optionally including the body.
mail-cli messages get <message-id>
mail-cli messages get <message-id> --body # include text body
mail-cli messages get <message-id> --body --html # include HTML body
Options:
--body Display the message body
--html Show HTML body instead of plain text (requires --body)
send
Send a new email. At least --body or --html-body is required.
mail-cli send \
--account <account-id> \
--to "alice@example.com,bob@example.com" \
--subject "Weekly Update" \
--body "Hi team, here's the weekly update."
Options:
--account <id> Account to send from (required)
--to <emails> Comma-separated recipients (required)
--subject <subject> Email subject (required)
--body <text> Plain text body
--html-body <html> HTML body
--cc <emails> Comma-separated CC recipients
--bcc <emails> Comma-separated BCC recipients
reply
Reply to an existing message.
mail-cli reply <message-id> --body "Thanks, looks good!"
mail-cli reply <message-id> --body "Noted, thanks everyone." --reply-all
Options:
--body <text> Reply body (required)
--html-body <html> HTML reply body
--reply-all Reply to all recipients
search
Full-text search across all accounts.
mail-cli search "invoice"
mail-cli search "project deadline" --account <id>
Options:
--account <id> Limit to a specific account
--page <n> Page number (default: 1)
--page-size <n> Results per page (default: 50, max: 100)
drafts list
List saved drafts.
mail-cli drafts list
mail-cli drafts list --account <id>
Options:
--account <id> Filter by account
--page <n> Page number (default: 1)
--page-size <n> Results per page (default: 50)
drafts create
Create a new draft.
mail-cli drafts create \
--account <account-id> \
--to "alice@example.com" \
--subject "Proposal" \
--body "Here's the draft proposal..."
Options:
--account <id> Account for the draft (required)
--to <emails> Comma-separated recipients
--subject <subject> Subject line
--body <text> Plain text body
--html-body <html> HTML body
drafts update
Update an existing draft.
mail-cli drafts update <draft-id> --subject "Updated Subject"
drafts send
Send a saved draft.
mail-cli drafts send <draft-id>
drafts delete
Delete a draft.
mail-cli drafts delete <draft-id>
mail-cli drafts delete <draft-id> --force # skip confirmation
folders list
List folders for an email account.
mail-cli folders list <account-id>
┌──────────────────────┬──────────┬──────────────────┬──────────┐
│ Name │ Path │ Type │ Messages │
├──────────────────────┼──────────┼──────────────────┼──────────┤
│ INBOX │ INBOX │ Inbox │ 1,247 │
│ Sent │ Sent │ Sent │ 892 │
│ Drafts │ Drafts │ Drafts │ 3 │
└──────────────────────┴──────────┴──────────────────┴──────────┘