smtp-logger
Mock SMTP server that logs the emails it receives.
Listens to inbound connections from SMTP clients. Supports a very minimal set of SMTP features, but probably enough that most clients will communicate happily and emails will get "delivered" as expected.
Why?
This is useful in development, typically as part of a docker-compose.yml.
There have been a couple cases recently where I wanted to work with an OSS tool that required a configured SMTP server (for instance, to send password reset or login link emails). The tool itself didn't offer an alternative, so creating a simple logging SMTP service seemed like the best way to go.
Installation and usage via Docker
This is probably how you want to use smtp-logger. This way your project does not need to depend on python (even though the docker image does).
The latest version of smtp-logger is packaged in a docker image available at ghcr.io/literalgarage/smtp-logger:latest.
For instance, to create an smtp logger service in your docker-compose.yml:
smtp:
image: ghcr.io/literalgarage/smtp-logger:latest
environment:
- SMTP_LOGGER_PORT=8025
ports:
- "8025:8025"
Installation and usage locally
Install this library using pip:
pip install smtp-logger
This provides an smtp-logger binary:
> smtp-logger --host 0.0.0.0 --port 8025
It accepts only --host and --port parameters. These are optional.
If not supplied, the SMTP_LOGGER_HOST and SMTP_LOGGER_PORT environment variables are used. These are also optional.
If configuration is missing then, by default, SMTP_LOGGER_HOST is 0.0.0.0 and SMTP_LOGGER_PORT is 8025.
Development
This is the simplest SMTP logging implementation that worked for the specific cases I ran into. There are an enormous number of basic and advanced SMTP features this server doesn't yet support. Its handling of content-transfer-encodings is weak at the moment. It doesn't support TLS. etc.
I'd love your help improving this tool!
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd smtp-logger
python -m venv .venv
source .venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[dev]'
To run tests:
make test
To run a full lint/typecheck/test pass:
make check
Metadata
Release files for smtp-logger 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smtp-logger-0.0.1.tar.gz | 6.4 kB | Without provenance | Details for smtp-logger-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smtp_logger-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for smtp_logger-0.0.1-py3-none-any.whl |
Total release size: 12.2 kB
Release files / smtp-logger-0.0.1.tar.gz
| Download URL | smtp-logger-0.0.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2469dcfccf5e5c2156966b209c99295db47f54cf11ea54973e820927896e01e
|
|
BLAKE2b-256 checksum How to use checksums |
dc008ff11a5baab1cc60a865267dafb545b97be0a56f7bcc46bb71b0cdbfd1a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / smtp_logger-0.0.1-py3-none-any.whl
| Download URL | smtp_logger-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e03be5a6cde9763cb1398aba7a6d3d33b21a4a8080b8867d36322d36c0877227
|
|
BLAKE2b-256 checksum How to use checksums |
d410fde3b04e7ee0dfcd0afee100154c8f393e49fdabc70ad75a968a5e1097cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for smtp-logger 0.0.1
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.