From 1e6b4b12a79b4e62248a4f7a844a5d9bdf9753de Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Mon, 14 May 2018 13:26:41 +0530 Subject: Add recipients to BCC field in send_bulk_mail function --- yaksh/send_emails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yaksh/send_emails.py') diff --git a/yaksh/send_emails.py b/yaksh/send_emails.py index ae49f23..4c9a7dc 100644 --- a/yaksh/send_emails.py +++ b/yaksh/send_emails.py @@ -65,7 +65,7 @@ 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: -- cgit From 97b657edc2a323f832c81f0e34ce5761bd21f7e9 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 24 May 2018 12:07:39 +0530 Subject: Pep8 changes --- yaksh/send_emails.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'yaksh/send_emails.py') diff --git a/yaksh/send_emails.py b/yaksh/send_emails.py index 4c9a7dc..e54e0a7 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,12 +60,13 @@ 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, - [settings.SENDER_EMAIL], bcc=recipients - ) + [settings.SENDER_EMAIL], bcc=recipients + ) msg.attach_alternative(email_body, "text/html") if attachments: for file in attachments: -- cgit From d26ff2db941355b40b395992338e02975abfd90d Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 7 Jun 2018 14:58:41 +0530 Subject: Format email attachment file path properly --- yaksh/send_emails.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'yaksh/send_emails.py') 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" ) -- cgit