Multiple attachments on mails
This commit is contained in:
parent
943dcf8abd
commit
ba23234a15
|
@ -18,7 +18,7 @@ def _send_email(
|
|||
bcc_recipients=[],
|
||||
html_template="",
|
||||
sender="BornHack <info@bornhack.dk>",
|
||||
attachment=None,
|
||||
attachments=(),
|
||||
attachment_filename="",
|
||||
):
|
||||
if not isinstance(to_recipients, list):
|
||||
|
@ -42,7 +42,8 @@ def _send_email(
|
|||
msg.attach_alternative(html_template, "text/html")
|
||||
|
||||
# is there an attachment to this mail?
|
||||
if attachment:
|
||||
if attachments:
|
||||
for attachment in attachments:
|
||||
# figure out the mimetype
|
||||
mimetype = magic.from_buffer(attachment, mime=True)
|
||||
msg.attach(attachment_filename, attachment, mimetype)
|
||||
|
|
Loading…
Reference in a new issue