outgoing extension for Mailgun
Project description
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.7 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).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file outgoing-mailgun-0.3.0.tar.gz
.
File metadata
- Download URL: outgoing-mailgun-0.3.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f920a6375de8c7a5afb530e90ca58930d2012f15c7671d948181449575fac51 |
|
MD5 | 8e93aa7ce30e7ab034051d42b459ebff |
|
BLAKE2b-256 | 74c9bd313b6445fcff0103036ce7123f303915ad6353e41749c244f9bec28808 |
File details
Details for the file outgoing_mailgun-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: outgoing_mailgun-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1531d61f8942f1603483e12310ee894ff7cd755d419fc8f0d48906f5758ddc8 |
|
MD5 | cfd301ad7b8cb51ad16e9b0b35a98703 |
|
BLAKE2b-256 | 28b36736db35e5613b60ef5e617d2f36ef6da85f2ee57c8cd031fd18ef06ad87 |