allow multiple reply_tos in the ugly way, temporary workaround

v1-0-stable
Christian Merten 7 years ago
parent 5cf9afa3cc
commit 83b4bd09a4

@ -13,14 +13,14 @@ def send(subject, content, sender, recipients, message_id, reply_to=None,
if type(recipients) != list:
recipients = [recipients]
if reply_to is not None:
kwargs = {"reply_to": [reply_to]}
kwargs = {"reply_to": reply_to}
else:
kwargs = {}
with mail.get_connection() as connection:
for recipient in set(recipients):
email = EmailMessage(subject, content, sender, [recipient],
connection=connection, **kwargs,
headers={'Message-ID': message_id})
headers={'Message-ID': message_id},
connection=connection, **kwargs)
if attachments is not None:
for attach in attachments:
email.attach_file(attach)

@ -21,7 +21,7 @@ class Command(BaseCommand):
if not replies:
# send mail to all jugendleiters
replies = Member.objects.filter(group__name='Jugendleiter',
replies = Member.objects.filter(group__name='Jugendleiter0',
gets_newsletter=True)
forwards = [l.email for l in replies]
subprocess.call(["forward"] + forwards)

@ -72,10 +72,15 @@ class Message(models.Model):
# remove any underscores from subject to prevent Arne from using
# terrible looking underscores in subjects
self.subject = self.subject.replace('_', ' ')
if len(self.reply_to.all()) > 0:
temporary_reply_to = [r.email for r in self.reply_to.all()]
else:
temporary_reply_to = None
try:
success = send(self.subject, get_content(self.content),
SENDING_ADDRESS,
emails,
reply_to=temporary_reply_to,
message_id=self.pk,
attachments=attach)
if success == SENT or success == PARTLY_SENT:

Loading…
Cancel
Save