Merge pull request #39 from Schlabonski/mailer_fix

send individual mails
v1-0-stable
Christian Merten 9 years ago committed by GitHub
commit fd14ff17c8

@ -9,17 +9,18 @@ def send(subject, content, sender, recipients, reply_to=None,
kwargs = {"reply_to": [reply_to]}
else:
kwargs = {}
email = EmailMessage(subject, content, sender, recipients, **kwargs)
if attachments is not None:
for attach in attachments:
email.attach_file(attach)
try:
email.send()
except Exception as e:
print("Error when sending mail:", e)
return False
else:
return True
for recipient in recipients:
email = EmailMessage(subject, content, sender, [recipient], **kwargs)
if attachments is not None:
for attach in attachments:
email.attach_file(attach)
try:
email.send()
except Exception as e:
print("Error when sending mail:", e)
return False
else:
return True
def get_content(content):

Loading…
Cancel
Save