2 Settings
Camila edited this page 2026-11-06 08:53:18 +01:00

django-nitro-mailer allows you to configure its behavior using Django settings.

You can set these settings in your Django project's settings.py file.

Settings list

NITRO_EMAIL_MAILER

  • Default: None (unset)
  • Availability: django-nitro-mailer 0.3.1+, Django 6.1+.
  • Description: The MAILERS alias used for actual delivery, for example "smtp". Django creates the transport from that alias's BACKEND and OPTIONS, so SMTP host, username, password, TLS, timeout, and other options belong there.
  • Precedence: When set, this alias takes precedence over NITRO_EMAIL_BACKEND. It is global and applies to synchronous delivery, queued delivery, retries, admin actions, and nitro_send_emails; per-message routing is not supported.
  • Errors: An unknown alias raises Django's MailerDoesNotExist. An alias pointing to SyncBackend or DatabaseBackend raises ImproperlyConfigured to prevent recursive delivery. Setting it on Django older than 6.1 also raises ImproperlyConfigured. Configuration errors leave queued messages in the queue.

When MAILERS is defined, configure either NITRO_EMAIL_MAILER or an explicit NITRO_EMAIL_BACKEND. Use the alias setting for SMTP credentials supplied through MAILERS. See the complete example in Quickstart.

NITRO_EMAIL_BACKEND

  • Default: "django.core.mail.backends.smtp.EmailBackend"
  • Description: Legacy delivery backend class path. Nitro constructs it directly without keyword options. With the legacy SMTP setup, it uses Django's EMAIL_* settings.
  • Compatibility: Ignored when NITRO_EMAIL_MAILER is set. An explicit custom backend can still be used alongside MAILERS, provided it configures itself without relying on the removed EMAIL_* settings. It does not inherit any MAILERS alias's OPTIONS.

NITRO_EMAIL_DATABASE_LOGGING

  • Default: True
  • Description: Enables or disables logging the result of sending an email to the database. If disabled, sending will still be logged, but only in the module logger.

NITRO_EMAIL_SEND_THROTTLE_MS

  • Default: 0
  • Description: The minimum time in milliseconds between sending emails. This setting is used to throttle the sending of emails. Useful to avoid hitting rate limits of email providers. Set to 0 to disable throttling.