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).

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 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 agent skill so Claude Code or Codex can send 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 SKILL.md to ~/.claude/skills/send-email/ and/or ~/.codex/skills/send-email/.

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.3.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.3.0
File Size Uploaded
email_cli_tool-0.3.0.tar.gz 47.0 kB Details

Built distribution (wheel)

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

Total release size: 61.4 kB

Release files / email_cli_tool-0.3.0.tar.gz

Download URL email_cli_tool-0.3.0.tar.gz
Size 47.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d3dca2f5a0ca833a8c3d0c2d79a190b36ccb7ea7074e46d4383302e149888aad
BLAKE2b-256 checksum
How to use checksums
91e773ff5a995a5f93d7048b57fab0ca3146b5db252a4bf7e2dc68b45bf8006d
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 30, 2026.

Transparency log

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

Download URL email_cli_tool-0.3.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
620f0698f7ffdabe32fe292d998392c2f2f3b8c96c9a956ae316b575edea888b
BLAKE2b-256 checksum
How to use checksums
738d44c66c8c3a41516181279fc541a5fbb723ff5b7cd74824e0517cd9c5ae53
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 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

This release

0.3.0 This release

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