summaryrefslogtreecommitdiff
path: root/yaksh/send_emails.py
diff options
context:
space:
mode:
authoradityacp2018-07-03 11:36:25 +0530
committeradityacp2018-07-03 11:36:25 +0530
commit637a75a5ea8fcae1e00c0200d52c471d50c8729a (patch)
tree9a2f13aaf80573fa44465031ccc6f895e7fdda0b /yaksh/send_emails.py
parent02705e4c676750291b6a5c4ea14e2947f29cb6c7 (diff)
parente3ad85ace916354ab96b23c1359ee72a6c2a740b (diff)
downloadonline_test-637a75a5ea8fcae1e00c0200d52c471d50c8729a.tar.gz
online_test-637a75a5ea8fcae1e00c0200d52c471d50c8729a.tar.bz2
online_test-637a75a5ea8fcae1e00c0200d52c471d50c8729a.zip
Update to latest changes
Diffstat (limited to 'yaksh/send_emails.py')
-rw-r--r--yaksh/send_emails.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/yaksh/send_emails.py b/yaksh/send_emails.py
index ae49f23..061cb0e 100644
--- a/yaksh/send_emails.py
+++ b/yaksh/send_emails.py
@@ -6,7 +6,6 @@ except ImportError:
from string import digits, punctuation
import hashlib
from textwrap import dedent
-import smtplib
import os
# Django imports
@@ -61,18 +60,20 @@ def send_user_mail(user_mail, key):
return success, msg
+
def send_bulk_mail(subject, email_body, recipients, attachments):
try:
text_msg = ""
msg = EmailMultiAlternatives(subject, text_msg, settings.SENDER_EMAIL,
- recipients
- )
+ [settings.SENDER_EMAIL], bcc=recipients
+ )
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"
)