Skip to content

Commit

Permalink
feat: Add django-post_office for mail queueing (#359)
Browse files Browse the repository at this point in the history
* feat: Use django-post_office for mail queueing

* Override the base setting in dev setting.

---------

Co-authored-by: Tim Schilling <schillingt@better-simple.com>
  • Loading branch information
sakhawy and tim-schilling authored Mar 31, 2024
1 parent eea7e73 commit aeae55a
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 234 deletions.
9 changes: 9 additions & 0 deletions indymeet/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"tailwind",
"theme",
"widget_tweaks",
"post_office",
]

MIDDLEWARE = [
Expand Down Expand Up @@ -222,6 +223,14 @@
SERVER_EMAIL = "contact@djangonaut.space"
SILENCED_SYSTEM_CHECKS = ["django_recaptcha.recaptcha_test_key_error"]

EMAIL_BACKEND = "post_office.EmailBackend"

POST_OFFICE = {
"BACKENDS": {
"default": "anymail.backends.mailjet.EmailBackend",
}
}

PUPUT_AS_PLUGIN = True
PUPUT_ENTRY_MODEL = "home.models.BlogAbstract"

Expand Down
2 changes: 1 addition & 1 deletion indymeet/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ["*"]

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
POST_OFFICE["BACKENDS"] = {"default": "django.core.mail.backends.console.EmailBackend"}

INSTALLED_APPS += ["django_extensions"] # noqa F405

Expand Down
1 change: 0 additions & 1 deletion indymeet/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
# unless there was a setting that needs it.
DATABASES["default"].setdefault("OPTIONS", {})["sslmode"] = "require"

EMAIL_BACKEND = "anymail.backends.mailjet.EmailBackend"
MAILJET_API_KEY = os.getenv("MAILJET_API_KEY")
MAILJET_SECRET_KEY = os.getenv("MAILJET_SECRET_KEY")
ANYMAIL = {
Expand Down
Loading

0 comments on commit aeae55a

Please sign in to comment.