|
|
@ -5,6 +5,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.conf import settings |
|
|
|
|
|
|
|
class PrefixingMailBackend(DjangoSMTPBackend): |
|
|
|
# method _send is not probably meant to be monkey_patched, so we patch send_messages instead. |
|
|
@ -13,4 +14,8 @@ 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.to = settings.TESTOVACI_EMAILOVA_KONFERENCE |
|
|
|
message.cc = [] |
|
|
|
message.bcc = [] |
|
|
|
return super().send_messages(messages) |
|
|
|