Skip to main content

Tests

ckanext-mailcraft

The ckanext-mailcraft adds powerful email management features to CKAN, making it easier to style, track, and control outgoing messages.

Features

  • Flexible Mailer – a custom mailer that can be easily extended to fit your needs
  • Pre-styled Templates – an example email template you can customize to match your branding
  • Email Logging – configurable option to save outgoing emails and view them in the dashboard
  • Email Control – configurable option to temporarily stop outgoing messages when needed
  • Redirection – configurable option to reroute all outgoing emails to one or more specified addresses

To enable the extension, add mailcraft to the ckan.plugins setting in your CKAN. If you want to enable the dashboard you should also add tables mailcraft_dashboard to the ckan.plugins setting.

Usage

To use a mailer, you just have to import it and initialize the mailer.

from ckanext.mailcraft.utils import get_mailer

mailer = get_mailer()

mailer.mail_recipients(
    subject="Hello world",
    recipients=["test@gmail.com"],
    body="Hello world",
    body_html=tk.render(
        "mailcraft/emails/test.html",
        extra_vars={"site_url": mailer.site_url, "site_title": mailer.site_title},
    ),
)

[!IMPORTANT] If you're using environment variables to configure the SMTP server, you must create the mailer instance within a method or function scope; otherwise, the mailer will take the config options from the CKAN config file.

Dashboard


To access the dashboard, first ensure that the tables mailcraft_dashboard plugins are enabled in your CKAN configuration. Then you'll have a button at the top right of the CKAN interface that will take you to the Mailcraft dashboard.

The tables plugin is required to render the dashboard table.

dashboard button

The dashboard provides an overview of all outgoing emails, including their status (sent, failed, etc.), recipients, and timestamps. You can filter and search through the emails to find specific ones.

dashboard

The ckanext.mailcraft.save_emails config option must be set to true to save outgoing emails and view them in the dashboard. You can also press the View button to see the full content of each email.

mail body

Requirements

Compatibility with core CKAN versions:

CKAN version Compatible?
2.9 and earlier no
2.10+ yes

Installation

Use PyPI to install the extension with pip. Or check the Developer installation section.

pip install ckanext-mailcraft

Config settings

Check the config_declaration.yaml file to see all available config settings.

Developer installation

To install ckanext-mailcraft for development, activate your CKAN virtualenv and do:

git clone https://github.com/DataShades/ckanext-mailcraft.git
cd ckanext-mailcraft
python setup.py develop
pip install -r dev-requirements.txt

Build CSS

Run this command from the theme folder.

npx sass styles.scss:./../assets/css/style.css -s compressed --no-source-map

Tests

To run the tests, do:

pytest --ckan-ini=test.ini

License

AGPL

Metadata

Release files for ckanext-mailcraft 0.9.2

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

Source distribution (sdist)

Source distribution for ckanext-mailcraft 0.9.2
File Size Uploaded Provenance Actions
ckanext_mailcraft-0.9.2.tar.gz 58.1 kB Without provenance Details for ckanext_mailcraft-0.9.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ckanext-mailcraft 0.9.2
File Interpreter ABI Platform Actions
ckanext_mailcraft-0.9.2-py3-none-any.whl Python 3 none any Details for ckanext_mailcraft-0.9.2-py3-none-any.whl

Total release size: 108.1 kB

Release files / ckanext_mailcraft-0.9.2.tar.gz

Download URL ckanext_mailcraft-0.9.2.tar.gz
Size 58.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4b11e6f897620ed9b04c67a40d898748878fa37a72b39ac84760c2f1cff57fa2
BLAKE2b-256 checksum
How to use checksums
613e4b955a02061ab2d9cc8d74d1840db38b232bb990b6aaa13152e50577bbcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / ckanext_mailcraft-0.9.2-py3-none-any.whl

Download URL ckanext_mailcraft-0.9.2-py3-none-any.whl
Size 50.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
889dbc489513d0ce32f6ffd34a1dc27dccadc065743bc04b73f5d0a39979402f
BLAKE2b-256 checksum
How to use checksums
c3893724cd42077063d2cf7d54b8f94124738a6320236b8c94ec13cb04bb31d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for ckanext-mailcraft 0.9.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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