summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2018-06-07 14:58:41 +0530
committeradityacp2018-06-07 14:58:41 +0530
commitd26ff2db941355b40b395992338e02975abfd90d (patch)
tree922cc5df1e69811a5fb2aa6388f971b9008df66b /yaksh
parent683cc77b3c5c8d7f63d8fd8384cc03d5ee089b43 (diff)
downloadonline_test-d26ff2db941355b40b395992338e02975abfd90d.tar.gz
online_test-d26ff2db941355b40b395992338e02975abfd90d.tar.bz2
online_test-d26ff2db941355b40b395992338e02975abfd90d.zip
Format email attachment file path properly
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/send_emails.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/yaksh/send_emails.py b/yaksh/send_emails.py
index e54e0a7..061cb0e 100644
--- a/yaksh/send_emails.py
+++ b/yaksh/send_emails.py
@@ -70,9 +70,10 @@ def send_bulk_mail(subject, email_body, recipients, attachments):
msg.attach_alternative(email_body, "text/html")
if attachments:
for file in attachments:
- path = default_storage.save('attachments/'+file.name,
- ContentFile(file.read())
- )
+ path = default_storage.save(
+ os.path.join('attachments', file.name),
+ ContentFile(file.read())
+ )
msg.attach_file(os.sep.join((settings.MEDIA_ROOT, path)),
mimetype="text/html"
)