Skip to main content

SRE Toolbox

SMTP Tester

Send a test email through an SMTP server to verify delivery.

Requires Python 3.13 or newer. The runtime is the standard library only.

Install

pip install lupaxa-smtp-tester
smtp-tester --help

CLI

smtp-tester --from-address from@example.com --to-address to@example.com \
  --smtp-username USER --smtp-password PASS \
  --smtp-server email-smtp.eu-west-1.amazonaws.com --smtp-port 587
smtp-tester -f from@example.com -t to@example.com -u USER -s smtp.example.com -P 587
smtp-tester -f from@example.com -t to@example.com -s smtp.internal.example.com --no-starttls
smtp-tester -f from@example.com -t to@example.com -u USER -s smtp.example.com --tls -P 465
python -m lupaxa.smtp_tester --version

The tool opens one SMTP session and sends a short plain-text message with Date and Message-ID. STARTTLS is required unless you pass --tls (implicit TLS, typically port 465) or --no-starttls. AUTH is optional: pass username and password together, or omit both for an internal relay. Credentials may come from --smtp-username / --smtp-password or SMTP_USERNAME / SMTP_PASSWORD. Flags override the environment. --timeout bounds the socket. --verbose logs steps (connect, EHLO, STARTTLS, AUTH, send) without protocol payloads.

A successful send prints email sent to <to-address> and exits 0. Failures go to stderr and exit 1. The password is never included in that output or in --verbose logs. --no-starttls sends in the clear; do not use it with credentials on an untrusted network.

Flags

Flag Default Description
--from-address required From address (-f)
--to-address required To address (-t)
--smtp-username SMTP_USERNAME SMTP username; omit with password to skip AUTH (-u)
--smtp-password SMTP_PASSWORD SMTP password; omit with username to skip AUTH (-p)
--smtp-server required SMTP hostname (-s)
--smtp-port 25 SMTP port (1–65535, -P)
--timeout 10 Socket timeout in seconds (-T)
--tls off Implicit TLS (SMTP_SSL, typically port 465)
--no-starttls off Do not require STARTTLS
--subject Simple test message Message subject
--body built-in body Plain-text body
--verbose off Log SMTP steps without protocol payloads (-v)
--version — Print the package version and exit

--timeout must be greater than 0. Username and password must both be set or both omitted.

Exit codes

Code When
0 Help, version, or the test message was accepted
1 Invalid arguments, mismatched credentials, or the send failed

Examples

Prefer environment credentials over the command line:

export SMTP_USERNAME='USER'
export SMTP_PASSWORD='your-smtp-password'
smtp-tester --from-address from@example.com --to-address to@example.com \
  --smtp-server smtp.example.com --smtp-port 587

Amazon SES needs an SES SMTP credential, not the AWS access key. The From address must be a verified identity in that SES region:

smtp-tester --from-address from@example.com --to-address to@example.com \
  --smtp-username AKIAexample --smtp-password SES_SMTP_PASSWORD \
  --smtp-server email-smtp.eu-west-1.amazonaws.com --smtp-port 587

Custom subject, body, timeout, and step logs:

smtp-tester --from-address from@example.com --to-address to@example.com \
  --smtp-username USER --smtp-password PASS \
  --smtp-server smtp.example.com --smtp-port 587 \
  --subject "SMTP probe" --body "ping" --verbose --timeout 15

Library

from lupaxa.smtp_tester import send_test_message

result = send_test_message(
    "smtp.example.com",
    587,
    "USER",
    "PASS",
    "from@example.com",
    "to@example.com",
)
print(result.ok, result.detail, result.smtp_code)

send_test_message returns an SmtpTestResult with ok, to_address, detail, and smtp_code. Pass use_tls=True for implicit TLS, or starttls=False to skip STARTTLS. Pass None for both username and password to skip AUTH. Invalid port or timeout, or only one credential, raises ValueError. Socket, TLS, authentication, and SMTP reply failures return ok=False instead of raising.

Development

make init
make python-install-dev
make python-check
The Lupaxa Project Footer

Metadata

Release files for lupaxa-smtp-tester 0.1.4

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

Source distribution (sdist)

Source distribution for lupaxa-smtp-tester 0.1.4
File Size Uploaded
lupaxa_smtp_tester-0.1.4.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lupaxa-smtp-tester 0.1.4
File Interpreter ABI Platform
lupaxa_smtp_tester-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 19.8 kB

Release files / lupaxa_smtp_tester-0.1.4.tar.gz

Download URL lupaxa_smtp_tester-0.1.4.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ea035aa670ff7601542a4a72502b416fdfe974553ab68b4cd2071d4777599f2b
BLAKE2b-256 checksum
How to use checksums
486c19e110c602b896fa3ad7baf49e62659bcb453e52f04a002d3684481279e6
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 Sep 30, 2026.

Transparency log

Release files / lupaxa_smtp_tester-0.1.4-py3-none-any.whl

Download URL lupaxa_smtp_tester-0.1.4-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bee58145c9f259e25aa131712896bcbd34a796acd944fe085b04a2288004ca52
BLAKE2b-256 checksum
How to use checksums
3f7f359db5f836286b0c0f4849b6c12df41fbcc4f658a9d9484665b61ba9d2d3
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 Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.5

2 release files

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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