Browse Source

Ododstavcování mailů…

middleware_test
Jonas Havelka 4 years ago
parent
commit
b74435f0fa
  1. 4
      various/mail_prefixer.py

4
various/mail_prefixer.py

@ -4,7 +4,7 @@ Used to distinguish testing emails from production ones."""
# We try to monkeypatch django.core.mail.backends.smtp :-)
from django.core.mail.backends.smtp import EmailBackend as DjangoSMTPBackend
from django.core.mail.backends.console import EmailBackend as DjangoSMTPBackend
from django.conf import settings
class PrefixingMailBackend(DjangoSMTPBackend):
@ -14,7 +14,7 @@ class PrefixingMailBackend(DjangoSMTPBackend):
for message in messages:
# We hope that this is a django.core.mail.message.EmailMessage
message.subject = prefix + ' ' + message.subject
message.body = "Bylo by posláno na e-maily: " + str(message.recipients()) + "\n" + message.body
message.body = "Bylo by posláno na e-maily: " + str(message.recipients()) + "\n\n" + message.body
message.to = settings.TESTOVACI_EMAILOVA_KONFERENCE
message.cc = []
message.bcc = []

Loading…
Cancel
Save