EmailBackend (backends/sendgrid.py)

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

SendGrid v3 email backend for Django AnyMail, handling API requests and recipient status parsing.

# 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.
import uuid
import warnings

from requests.structures import CaseInsensitiveDict

from ..exceptions import (
    AnymailConfigurationError,
    AnymailNotSupportedWarning,
    AnymailSerializationError,
    AnymailWarning,
)
from ..message import AnymailRecipientStatus
from ..utils import BASIC_NUMERIC_TYPES, Mapping, get_anymail_setting, update_deep
from .base_requests import AnymailRequestsBackend, RequestsPayload


class EmailBackend(AnymailRequestsBackend):
    """
    SendGrid v3 API Email Backend
    """

    esp_name = "SendGrid"

    def __init__(self, **kwargs):
        """Init options from Django se

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

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

Get a free API key