Skip to main content

Project Status: Active — The project has reached a stable, usable state and is being actively developed. CI Status coverage pyversions MIT License

GitHub | PyPI | Issues | Changelog

outgoing-mailgun is an extension for outgoing that adds the ability to send e-mails via Mailgun. Simply install outgoing-mailgun alongside outgoing, and you’ll be able to specify “mailgun” as a sending method in your outgoing configuration.

Installation

outgoing-mailgun requires Python 3.8 or higher. Just use pip for Python 3 (You have pip, right?) to install outgoing-mailgun and its dependencies (including outgoing):

python3 -m pip install outgoing-mailgun

Configuration

When using “mailgun” as the sending method in an outgoing configuration, the following configuration fields are recognized:

base-urlHTTP URL (optional)

The base URL to use for Mailgun API requests. This should be either "https://api.mailgun.net" (the default) for domains in Mailgun’s US region or "https://api.eu.mailgun.net" for domains in Mailgun’s EU region. Trailing slashes on the URL are optional.

domainstring (required)

The domain name you registered with Mailgun for sending e-mail

api-keypassword (required)

A Mailgun API key for your domain; see the outgoing documentation on passwords for ways to write this field.

When using the keyring password scheme or another scheme that takes optional host/service and username fields, if the service and/or username is not supplied in the password specifier, then the service defaults to the domain name of the base-url field, and the username defaults to the value of the domain field.

tagslist of strings (optional)

A set of tags to apply to sent e-mails

deliverytimedatetime (optional)

Desired time of delivery for sent e-mails; if no timezone offset is given, it is assumed to be in the local system timezone

dkimboolean (optional)

Enable/disable DKIM signatures on sent e-mails

testmodeboolean (optional)

Whether to send in test mode

trackingboolean (optional)

Whether to enable message tracking

tracking-clicksboolean or "htmlonly" (optional)

Whether to enable clicks tracking in e-mails

tracking-opensboolean (optional)

Whether to enable opens tracking in e-mails

headerstable with string values (optional)

A collection of custom MIME headers to append to sent e-mails

variablestable with string values (optional)

A collection of Mailgun variables to attach to sent e-mails

Example Configuration

[outgoing]
method = "mailgun"
domain = "mydomain.nil"
api-key = { file = "~/secrets/mailgun.key" }
dkim = true
tags = [ "sent-with-outgoing", "my-campaign" ]
tracking-clicks = "htmlonly"
headers = { Reply-To = "me@mydomain.nil" }
variables = { sender = "outgoing", foo = "bar" }

Sender-Specific Behavior

The MailgunSender class provided by this extension is a reentrant and reusable context manager, and its send() method can be called outside of a context. In addition, on success, the send() method returns the message ID of the newly-sent e-mail (without enclosing angle brackets).

Release files for outgoing-mailgun 0.3.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 outgoing-mailgun 0.3.2
File Size Uploaded
outgoing_mailgun-0.3.2.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for outgoing-mailgun 0.3.2
File Interpreter ABI Platform
outgoing_mailgun-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / outgoing_mailgun-0.3.2.tar.gz

Download URL outgoing_mailgun-0.3.2.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
904a81f3bc9355323d0e440e43254486e9599ab0875ea997269543d06bf49f12
BLAKE2b-256 checksum
How to use checksums
73f412f8607705b814facf6de835f678e86edffb4dae9d2cf95c98df28408920
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Release files / outgoing_mailgun-0.3.2-py3-none-any.whl

Download URL outgoing_mailgun-0.3.2-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
668a4512730063a38ec6685adc9d051c8ff08c5cd4c80fa8e491208c69b9343b
BLAKE2b-256 checksum
How to use checksums
1ef62321e92bc6fd7ad143688a5c09f72905be6f909ec5e13c573cb01d5308b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

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