Skip to main content

License: MIT PyPI - Python Version Code style: black

mail-devel

This tool combines an in-memory SMTP mail-sink with an IMAP server. All mails coming over SMTP are stored in the IMAP inbox. This can be used to test outgoing and incoming mail configurations. Built on top of aiosmtpd and pymap.

The frontend is minimally handling the content of the mailbox. Please connect a proper mail client like Thunderbird for more advanced usage.

DO NOT USE FOR PRODUCTION.

Features

  • Receive, send mails, and reply to mails
  • Generate randomized mails using the HTTP frontend
  • Manage IMAP flags and automated flagging
  • Minimal HTTP frontend to support the basic testing
  • SMTP auto respond feature for automatic testing (see --smtp-responder)
  • Single or multi mail account mode (see configuration)
  • Mail aliases if in multi account mode

Usage

Docker

docker run -p 4080:4080 -p 4025:4025 -p 4143:4143 --rm fkantelberg/mail-devel --password abc

Docker Compose

The following example assumes that the tool is run in a docker compose network as one of the services and only need to publish the HTTP port.

  • Minimally define password in .env with MAILSINK_PASSWORD
  • Additionally define port in .env with MAILSINK_HTTP

Following the section from the docker-compose.yaml:

services:
  mailsink:
    image: fkantelberg/mail-devel:${MAILSINK_TAG:-latest}
    environment:
      MAIL_USER: ${MAILSINK_USER:-test@example.org}
    command: [--password, $MAILSINK_PASSWORD, --smtp-flagged-seen]
    ports:
      - ${MAILSINK_HTTP:-127.0.0.1:4080}:4080
      # If you want to connect a normal mail client via SMTP and IMAP
      # - ${MAILSINK_SMTP:-127.0.0.1:4025}:4025
      # - ${MAILSINK_IMAP:-127.0.0.1:4143}:4143

Python

$ pip install mail-devel
$ mail_devel --password secret

Configuration

Please use --help for a more complete overview of the configurations.

  • --password: The password for SMTP and IMAP

  • --auth-required: Disables SMTP without authentication

  • --flagged-seen: If set incoming mails are automatically flagged as seen/read. If you only want to flag mails coming via SMTP as seen use --smtp-flagged-seen

  • --multi-user: Switches from single user to multi user mode

    • Single User Mode: All mails are collected in a single mailbox which belongs to the defined user.

    • Multi User Mode: The mails are collected in the specific mailboxes for each receiver of the messages using the to, cc, and bcc mail headers. Allows the usage of mail aliases

  • --alias: Can be specified multiple times to map mail addresses using UNIX shell-style wildcards. Aliases can also be specified via a comma-separated list in the environment variable MAIL_ALIAS

  • --smtp-responder: Automatically respond to the mails coming in via SMTP

    • --smtp-responder reply_once: Reply once per mail thread
    • --smtp-responder reply_always: Always reply to incoming mails
    • --smtp-responder path/to/script.py: Custom auto responder. See the examples

Supported protocols for mails

  • SMTP (optionally with STARTTLS)
  • SMTPS
  • IMAP (optionally with STARTTLS)

References

Metadata

Release files for mail-devel 0.16.2

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

Built distribution (wheel)

Table of built distributions (wheels) for mail-devel 0.16.2
File Interpreter ABI Platform
mail_devel-0.16.2-py3-none-any.whl Python 3 none any Details

Release files / mail_devel-0.16.2-py3-none-any.whl

Download URL mail_devel-0.16.2-py3-none-any.whl
Size 29.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f4492bec229ecf1c5cf45bd6fa804e5876fdc77cd6ce3b3d52e247e2b936511
BLAKE2b-256 checksum
How to use checksums
13b03da625902b32115180139f55e0cff1bc7d9492c7c6e621e8cc0115c95111
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for mail-devel 0.16.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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