Skip to main content

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

Project description

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

Installation

# From PyPI
pip install email-cli-tool

# Or with uv
uv tool install email-cli-tool

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 -

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 init

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

emailcli config show

Display current configuration (password is masked).

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

Development

# Install dependencies
uv sync

# Run tests
uv run pytest -v

# Run locally
uv run emailcli --help

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

email_cli_tool-0.1.0.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

email_cli_tool-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file email_cli_tool-0.1.0.tar.gz.

File metadata

  • Download URL: email_cli_tool-0.1.0.tar.gz
  • Upload date:
  • Size: 31.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for email_cli_tool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 21b5546397a251a95cc2e31550aa2c45602364387d8d30c02ae80a9260120d89
MD5 1d19442db8a6be2b2cade0af50a83745
BLAKE2b-256 4404d0a25126df7337aefd6369292a705a022908f391999473ba46707c453161

See more details on using hashes here.

Provenance

The following attestation bundles were made for email_cli_tool-0.1.0.tar.gz:

Publisher: publish.yml on ClaymanTwinkle/email-cli-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file email_cli_tool-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: email_cli_tool-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for email_cli_tool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a02a8c6f9e80cea5868ee5b2b5ef38c40c0f713adf80193fa1ddc2033768e6f
MD5 d3592cf51cf99d13975b46fd73a2a3a1
BLAKE2b-256 ed8e62e431dc3b2ef1dc3fba6fc5e32a868dd711b60becaa25ea6d9b4853e9d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for email_cli_tool-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ClaymanTwinkle/email-cli-tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page