send individual mails

v1-0-stable
Christian Merten 9 years ago
parent 44099810b7
commit 3ad2520184

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

Loading…
Cancel
Save