Add debug setting for email-sending

Fix #86
This commit is contained in:
Klaas van Schelven
2025-11-03 21:35:09 +01:00
parent 0bbb00c6ad
commit c38aace3ae
4 changed files with 17 additions and 0 deletions

View File

@@ -115,6 +115,10 @@ if os.getenv("EMAIL_HOST"):
# True, we use that.
EMAIL_USE_SSL = os.getenv("EMAIL_USE_SSL", "False").lower() in ("true", "1", "yes")
EMAIL_USE_TLS = os.getenv("EMAIL_USE_TLS", str(not EMAIL_USE_SSL)).lower() in ("true", "1", "yes")
if os.getenv("EMAIL_LOGGING", "false").lower() in ("true", "1", "yes"):
LOGGING['loggers']['bugsink.email']['level'] = "INFO"
else:
# print("WARNING: EMAIL_HOST not set; email will not be sent")
EMAIL_BACKEND = "bugsink.email_backends.QuietConsoleEmailBackend"

View File

@@ -71,6 +71,10 @@ EMAIL_BACKEND = "bugsink.email_backends.QuietConsoleEmailBackend" # instead of
# EMAIL_USE_TLS = ...
# EMAIL_USE_SSL = ...
# Uncomment the line below to show all sent emails in the logs
# LOGGING['loggers']['bugsink.email']['level'] = "INFO"
SERVER_EMAIL = DEFAULT_FROM_EMAIL = "Bugsink <bugsink@example.org>"
# constants for "create by" (user/team/project) settings

View File

@@ -356,6 +356,13 @@ LOGGING['loggers']['bugsink.performance'] = {
"propagate": False,
}
# Email logging is hidden below WARNING by default, but this can be changed by setting the level to INFO.
LOGGING['loggers']['bugsink.email'] = {
"level": "WARNING",
"handlers": ["console"],
"propagate": False,
}
# Snappea Logging
LOGGING["formatters"]["snappea"] = {
"format": "{threadName} - {levelname:7} - {message}",

View File

@@ -30,6 +30,8 @@ def send_rendered_email(subject, base_template_name, recipient_list, context=Non
)
return
logger.info("Sending email with subject '%s' to %s", subject, recipient_list)
if context is None:
context = {}