summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkomalsheth2862016-12-15 10:10:49 +0530
committerkomalsheth2862016-12-15 10:10:49 +0530
commita7a6f1475bdd29d033aed39635e79fd8e2bd8f02 (patch)
tree91ec18b538c8338ae49f9293b873fe5330e42a85
parent97ee1134d952e2e62f9702602f821d724f666230 (diff)
downloadcertificate-generator-a7a6f1475bdd29d033aed39635e79fd8e2bd8f02.tar.gz
certificate-generator-a7a6f1475bdd29d033aed39635e79fd8e2bd8f02.tar.bz2
certificate-generator-a7a6f1475bdd29d033aed39635e79fd8e2bd8f02.zip
Email template changed to plain mail
-rwxr-xr-xcertificate/views.py33
1 files 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