From a7a6f1475bdd29d033aed39635e79fd8e2bd8f02 Mon Sep 17 00:00:00 2001 From: komalsheth286 Date: Thu, 15 Dec 2016 10:10:49 +0530 Subject: Email template changed to plain mail --- certificate/views.py | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/certificate/views.py b/certificate/views.py index cf5e437..8f0958f 100755 --- a/certificate/views.py +++ b/certificate/views.py @@ -1949,16 +1949,33 @@ def create_scipy_certificate_2016(certificate_path, name, qrcode, type, paper, w path = os.path.join(certificate_path, str(file_name)+ ".pdf") print "path-------------", path try : - subject = 'subject' - from_email = 'from_email@gmail.com' + sender_name = "scipy" + sender_email = "from_email@gmail.com" + subject = "SciPy India 2016 - Certificate" to = ['inbox.komal@gmail.com',] - message = path - msg = EmailMultiAlternatives(subject, message, from_email, [to]) - msg.attach_file(path) - msg.content_subtype = "html" - msg.send() + + message = """ Hello, + Sending plain mail for testing + """ + + email = EmailMultiAlternatives( + subject,'', + sender_email, to, + headers={"Content-type":"text/html;charset=iso-8859-1"} + ) + email.attach_alternative(message, "text/html") + email.send(fail_silently=True) + + # subject = 'subject' + # from_email = 'from_email@gmail.com' + # to = ['inbox.komal@gmail.com',] + # message = path + # msg = EmailMultiAlternatives(subject, message, from_email, [to]) + # msg.attach_file(path) + # msg.content_subtype = "html" + # msg.send() except Exception as e: - print e + print "===============================", e return [None, False] else: error = True -- cgit