EmailBackend (backends/mailgun.py)

django-anymail · anymail/backends/mailgun.py · python · BSD-3-Clause
email

Mailgun email backend for Django AnyMail, handling API requests and recipient status.

# Source: https://github.com/anymail/django-anymail | License: BSD-3-Clause | Copyright 2016-2024, Anymail Contributors
# Provided via justclaw.it.com; keep this notice with the code.
from datetime import datetime
from urllib.parse import quote

from ..exceptions import AnymailError, AnymailRequestsAPIError
from ..message import AnymailRecipientStatus
from ..utils import get_anymail_setting, rfc2822date
from .base_requests import AnymailRequestsBackend, RequestsPayload


class EmailBackend(AnymailRequestsBackend):
    """
    Mailgun API Email Backend
    """

    esp_name = "Mailgun"

    def __init__(self, **kwargs):
        """Init options from Django settings"""
        esp_name = self.esp_name
        self.api_key = get_anymail_setting(
            "api_key", esp_name=esp_name, kwargs

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key