Skip to main content

SMTP and IMAP roundtrip check

This packages sends a test email via SMTP, and checks that it was received via IMAP. Requires Python 3.x, since the stdlib in 2.x is missing too many features in this area.

Usage

Create a configuration file:

[default]
recipient = test@example.com
smtp_host = smtp.example.com:25
imap_host = imap.example.com:143
imap_username = test@example.com
imap_password = secret

Now run mail-check-roundtrip example.conf. It will send a message with a random string in the X-Mailcheck-Token header, and then poll until receive_timeout to see if a message with that string was rececived (this message is then deleted). The exit status is 0 if sucessful, 1 on errors (e.g. connection failed) and 2 if the message could not be found.

Options

The following configuration options are supported and these are their defaults:

[default]
recipient = # REQUIRED
from = # defaults to recipient
headers = # default empty
    Subject: This is a test
    X-Custom-Header: one

smtp_host = localhost:25
smtp_ssl = starttls  # or `ssl` or `none` (not recommended)
smtp_username =
smtp_password =

imap_host = localhost:143
imap_ssl = starttls  # or `ssl` or `none` (not recommended).
imap_username = # REQUIRED
imap_password = # REQUIRED
imap_folder = INBOX

poll_timeout = 60
poll_interval = 10
poll_delete = true  # Delete the message after it was found
loglevel = WARNING  # This means no output for a successful run.

CHANGES

1.0.5 (2023-04-04)

Changes

  • Switch from setup.py to pyproject.toml (wheel)

1.0.5 (2023-04-04)

Changes

  • Switch from setup.py to pyproject.toml (wheel)

1.0.4 (2021-08-15)

  • Reduce loglevel for smtp/imap errors to prevent stdout output.

1.0.3 (2019-02-26)

  • Catch smtp/imap errors and exit, so we don’t produce output on stdout (which is annoying in cronjobs).

1.0.2 (2018-04-08)

  • Fix typo in console script name.

1.0.1 (2018-04-07)

  • Fix typo because smtplib.starttls has context and imaplib.starttls has ssl_context as the kw name, sigh.

1.0.0 (2018-04-07)

  • First release.

Release files for ws.mailcheck 1.0.5

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

Source distribution (sdist)

Source distribution for ws.mailcheck 1.0.5
File Size Uploaded
ws.mailcheck-1.0.5.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ws.mailcheck 1.0.5
File Interpreter ABI Platform
ws.mailcheck-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size:8.2 kB

Release files / ws.mailcheck-1.0.5.tar.gz

Download URL ws.mailcheck-1.0.5.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
36a64591d521ee5d00a27e27f7b9cfd27dbbbb1de058a4421db01d5a925d6efc
BLAKE2b-256 checksum
How to use checksums
9a6a9dd30f9788f3b03084a256de8f22ec6c8e445dd3cde8d9c6cd1a904b5cdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.3

Release files / ws.mailcheck-1.0.5-py3-none-any.whl

Download URL ws.mailcheck-1.0.5-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb84c9d798aee43914146efbe14678b34657174a1ae5e3e7af12c2dfdf218a49
BLAKE2b-256 checksum
How to use checksums
101c8d48c2e08ee74ed9747f3e406871d006e837c96dc4b6d4b2e3b53df1c6ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.3

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

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