Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Add DEFAULT_FROM_EMAIL setting handling #677

Merged
merged 1 commit into from
May 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/catalog/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD", default="")
EMAIL_SUBJECT_PREFIX = "[noreply]"
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = config("DEFAULT_FROM_EMAIL", default="")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Django default is webmaster@localhost, did we want to mirror that here so it's more obvious when this isn't set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'd vote for this group of required email settings to not have defaults unless some parent setting was turned off.

if config("ENABLE_EMAIL", default=True, cast=bool):
    DEFAULT_FROM_EMAIL = config("DEFAULT_FROM_EMAIL")  # no default! This should be an error if you don't supply it
    # etc...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this!


if EMAIL_HOST_USER or EMAIL_HOST_PASSWORD:
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
Expand Down