diff --git a/CHANGELOG.md b/CHANGELOG.md index a688249..85b577f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) since 0.4.1, and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## UNRELEASED (XXXX-YY-ZZ) + +### Added + +- `EMAIL_ENABLE` setting (True/False) allows completely disabling of email sending + ## 1.3.0 (2024-11-02) This is a small release, with a few features and bugfixes. The code is now diff --git a/la_chariotte/mail/utils.py b/la_chariotte/mail/utils.py index 8b91873..b50bfbf 100644 --- a/la_chariotte/mail/utils.py +++ b/la_chariotte/mail/utils.py @@ -22,4 +22,7 @@ def send_order_confirmation_mail(order): from_email = settings.DEFAULT_FROM_EMAIL to = order.author.email - mail.send_mail(subject, plain_message, from_email, [to], html_message=html_message) + if settings.EMAIL_ENABLE: + mail.send_mail( + subject, plain_message, from_email, [to], html_message=html_message + ) diff --git a/la_chariotte/settings.py b/la_chariotte/settings.py index ab6dadc..70126d8 100644 --- a/la_chariotte/settings.py +++ b/la_chariotte/settings.py @@ -174,6 +174,7 @@ if SENTRY_DSN: ) # Email settings +EMAIL_ENABLE = True EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" EMAIL_HOST = os.getenv("EMAIL_HOST") EMAIL_PORT = int(os.getenv("EMAIL_PORT", "587"))