Notix
Integrations

Django's mail, and the Notix API beside it.

Django already has an email system, and the fastest integration keeps it: point the SMTP backend at the relay and send_mail, EmailMessage and the password reset view all go through Notix. Add the notix-sdk client for the sends where a retry must never mean a second email.

The send

Send an email from Django.

SMTP backend
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.usenotix.dev"
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "notix"
EMAIL_HOST_PASSWORD = os.environ["NOTIX_API_KEY"]
DEFAULT_FROM_EMAIL = "Acme <receipts@acme.com>"

The from address must be on a domain you have verified in Notix. Step by step: the Python quickstart and the longer guide to sending email from Django.

Webhooks

Verify delivery events over the raw body.

Notix signs every webhook call with the webhook's signing secret: an HMAC-SHA256 of the X-Notix-Timestamp header, a dot and the raw body, sent in X-Notix-Signature. The SDKs check the signature and refuse a call more than 5 minutes old.

Pass the request body as bytes, before any JSON parsing: the signature covers the exact bytes Notix sent. A bad call raises WebhookVerificationError; answer 400.

A Django view for Notix webhooks
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from notix import WebhookVerificationError

webhooks = notix.webhooks(os.environ["NOTIX_WEBHOOK_SECRET"])

@csrf_exempt
@require_POST
def notix_webhook(request):
    try:
        event = webhooks.construct_event(request.body, headers=request.headers)
    except WebhookVerificationError:
        return HttpResponseBadRequest("invalid signature")
    return HttpResponse("ok")
FAQ

Questions, answered.

Do Django's password reset emails go through Notix?
Yes, once EMAIL_BACKEND is the SMTP backend pointed at smtp.usenotix.dev. Set DEFAULT_FROM_EMAIL to an address on a domain you have verified.
What if the same request runs twice?
Send an Idempotency-Key header (idempotencyKey in notix-js) with a value that names the thing being sent, such as order-4471-receipt. A repeat with the same key and body returns the first result and sends nothing new; the same key with a different body is refused with 409.
Why is my send refused with a from-address error?
The from address must be on a domain you have verified in Notix. Add the domain in the console, publish the DNS records it shows, and wait for verification; until then, sends from that domain are refused.

The free plan does not ask for a card.

Send your first email in five minutes.

Verify a domain, copy an API key, make one call. The free plan does not ask for a card.