Skip to main content

email-cli-tool

A simple CLI tool for sending emails with plain text, HTML, and file attachments.

中文文档

Features

  • Send plain text / HTML / mixed format emails
  • Attach multiple files and images
  • Multiple recipients support
  • Direct SMTP connection (SSL / STARTTLS)
  • Interactive configuration wizard
  • Read body content from stdin
  • Wait for the next incoming email (IMAP) and download its attachments

Installation

# From PyPI (latest)
pip install email-cli-tool

# Install a specific version
pip install email-cli-tool==0.2.0

# Upgrade an existing install
pip install --upgrade email-cli-tool

# Or with uv
uv tool install email-cli-tool          # latest
uv tool install email-cli-tool==0.2.0   # specific version

The emailcli skill install command requires version 0.2.0 or newer.

Quick Start

1. Initialize Configuration

emailcli init

Follow the prompts to enter your SMTP settings. Example for Gmail:

Field Value
From address yourname@gmail.com
SMTP host smtp.gmail.com
SMTP port 465
SMTP username yourname@gmail.com
SMTP password App password
Encryption ssl

2. Send Emails

# Plain text
emailcli send --to user@example.com --subject "Hello" --body "Hello World"

# HTML format
emailcli send --to user@example.com --subject "Notice" \
  --html "<h1>Title</h1><p>Body content</p>"

# With attachments
emailcli send --to user@example.com --subject "Report" \
  --body "Please see attachments" \
  --attach report.pdf \
  --attach photo.png

# Multiple recipients
emailcli send \
  --to a@example.com \
  --to b@example.com \
  --subject "Broadcast" --body "Hello everyone"

# HTML body from file
emailcli send --to user@example.com --subject "Newsletter" \
  --html-file template.html

# Read body from stdin
echo "Content" | emailcli send \
  --to user@example.com --subject "Piped" --body -

3. Wait for Incoming Email

# Block until the next email arrives, print it, then exit
emailcli watch

# Wait up to 5 minutes and save attachments
emailcli watch --timeout 300 --save-attachments ./downloads

Requires IMAP settings — emailcli init asks for them, or add an imap section to the config (see below).

4. Read Existing Emails

# List the 10 newest emails (UID, date, sender, subject)
emailcli list

# Read the newest email
emailcli read

# Read a specific email by UID and save its attachments
emailcli read 1774452489 --save-attachments ./downloads

Also requires IMAP settings. Both commands open the mailbox read-only, so nothing is marked as read.

Command Reference

emailcli send

Option Required Repeatable Description
--to ✅ ✅ Recipient email address
--subject ✅ Email subject
--body Plain text body, - reads from stdin
--html HTML body string (mutually exclusive with --html-file)
--html-file Read HTML body from file (mutually exclusive with --html)
--attach ✅ Attachment file path
--from Override sender address from config

At least one of --body, --html, or --html-file is required.

emailcli watch

Wait for the next incoming email (via IMAP polling), print headers and body to stdout, then exit. Only emails arriving after the command starts are matched; the received email is marked as read.

Option Default Description
--timeout 0 (wait forever) Max seconds to wait; exits with code 2 on timeout
--poll-interval 10 Seconds between mailbox checks
--save-attachments Directory to save attachments into
--mailbox INBOX Mailbox to watch

emailcli list

List the newest emails, newest first — one per line: UID, date, sender, subject (tab-separated). The mailbox is opened read-only, so nothing is marked as read.

Option Default Description
--limit 10 Number of newest messages to show
--mailbox INBOX Mailbox to list

emailcli read [UID]

Read one email by UID (as shown by emailcli list), or the newest one when no UID is given. Prints headers and body like watch. The mailbox is opened read-only, so the message is not marked as read. Exits with code 2 when the mailbox is empty.

Option Default Description
--save-attachments Directory to save attachments into
--mailbox INBOX Mailbox to read from

emailcli init

Interactively create the configuration file at ~/.emailcli/config.yaml.

emailcli config show

Display current configuration (password is masked).

emailcli skill install

Install the send-email, wait-email, and read-email agent skills so Claude Code or Codex can send, receive, and read mail for you.

# Install for both Claude Code and Codex (default)
emailcli skill install

# Only one agent
emailcli skill install --target claude
emailcli skill install --target codex

Writes each skill's SKILL.md under ~/.claude/skills/ and/or ~/.codex/skills/.

Configuration

Path: ~/.emailcli/config.yaml

from: yourname@gmail.com
smtp:
  host: smtp.gmail.com
  port: 465
  username: yourname@gmail.com
  password: your-app-password
  encryption: ssl  # ssl | starttls | none

# Optional, only needed for `emailcli watch`
imap:
  host: imap.gmail.com
  port: 993        # default: 993
  encryption: ssl  # default: ssl
  # username/password default to the smtp values

Development

# Install dependencies
uv sync

# Run tests
uv run pytest -v

# Run locally
uv run emailcli --help

License

MIT

Metadata

Release files for email-cli-tool 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for email-cli-tool 0.4.0
File Size Uploaded
email_cli_tool-0.4.0.tar.gz 51.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for email-cli-tool 0.4.0
File Interpreter ABI Platform
email_cli_tool-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.2 kB

Release files / email_cli_tool-0.4.0.tar.gz

Download URL email_cli_tool-0.4.0.tar.gz
Size 51.5 kB
Tags Source
SHA-256 checksum
How to use checksums
78ff8d453838bfec36451f101ba6ff380aadb67e5c4a9182e405ab45cc54074d
BLAKE2b-256 checksum
How to use checksums
6d952e9fa92c43e8d09cd61df7ab9a2a99d0cb22b54f6eab082a31adc23d514c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release files / email_cli_tool-0.4.0-py3-none-any.whl

Download URL email_cli_tool-0.4.0-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1d75be7c65ec2e1a0499f5800e9a15a06826ae53b557ac7fb11748d79f1512c
BLAKE2b-256 checksum
How to use checksums
ce5c8dcf780f844c94da93d1b5f4139a2e0585ddfe9aac9abab723a2a4fe9343
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page