mirror of
https://github.com/bugsink/bugsink.git
synced 2026-05-05 14:30:06 -05:00
Email backend: don't barf on the screen
This commit is contained in:
@@ -61,7 +61,7 @@ if os.getenv("EMAIL_HOST"):
|
||||
EMAIL_USE_TLS = os.getenv("EMAIL_USE_TLS", "True").lower() in ("true", "1", "yes")
|
||||
else:
|
||||
# print("WARNING: EMAIL_HOST not set; email will not be sent")
|
||||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
EMAIL_BACKEND = "bugsink.email_backends.QuietConsoleEmailBackend"
|
||||
|
||||
SERVER_EMAIL = DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL", "Bugsink <bugsink@example.org>")
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
from django.core.mail.backends.console import EmailBackend as ConsoleEmailBackend
|
||||
|
||||
|
||||
class QuietConsoleEmailBackend(ConsoleEmailBackend):
|
||||
|
||||
def write_message(self, message):
|
||||
msg = message.message()
|
||||
# self.stream.write("From: %s\n" % msg["From"])
|
||||
# self.stream.write("To: %s\n" % msg["To"])
|
||||
self.stream.write("Mail not sent (not SMTP configured); Subject: %s\n" % msg["Subject"])
|
||||
Reference in New Issue
Block a user