From 3d61cf7907211dd4b9cbdaa8b23d41e30b5fdbe1 Mon Sep 17 00:00:00 2001 From: Jonas Havelka Date: Tue, 25 May 2021 23:49:39 +0200 Subject: [PATCH] =?UTF-8?q?Vyjmout=20chybov=C3=A9=20hl=C3=A1=C5=A1ky.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- various/mail_prefixer.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/various/mail_prefixer.py b/various/mail_prefixer.py index 94fe5fa9..456b6be7 100644 --- a/various/mail_prefixer.py +++ b/various/mail_prefixer.py @@ -13,9 +13,11 @@ class PrefixingMailBackend(DjangoSMTPBackend): prefix = '[Mail z testwebu]' 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\n" + message.body - message.to = settings.TESTOVACI_EMAILOVA_KONFERENCE - message.cc = [] - message.bcc = [] + + if len(message.from_email) == 0 or message.from_email[0] != settings.SERVER_EMAIL: + message.subject = prefix + ' ' + message.subject + 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 = [] return super().send_messages(messages)