raannakasturi commited on
Commit
b59afc0
1 Parent(s): 2b2b0d0

Update send_mail.py

Browse files
Files changed (1) hide show
  1. send_mail.py +6 -5
send_mail.py CHANGED
@@ -37,9 +37,9 @@ def send_email(email, private_key, csr, cert, generation_details):
37
  api_instance = sib_api_v3_sdk.TransactionalEmailsApi(sib_api_v3_sdk.ApiClient(configuration))
38
 
39
  data = mail_body(generation_details)
40
- p_attachment = create_attachment(private_key.encode('utf-8'), "private_key.txt")
41
- c_attachment = create_attachment(csr.encode('utf-8'), "csr.txt")
42
- s_attachment = create_attachment(cert.encode('utf-8'), "cert.txt")
43
 
44
  subject = "Project Gatekeeper - Your SSL Certificate is ready!"
45
  sender = {"name": "Project Gatekeeper", "email": "gatekeeper@raannakasturi.eu.org"}
@@ -54,6 +54,7 @@ def send_email(email, private_key, csr, cert, generation_details):
54
  send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(to=to, reply_to=reply_to, attachment=attachments, text_content=text_content, sender=sender, subject=subject)
55
  try:
56
  api_response = api_instance.send_transac_email(send_smtp_email)
57
- print(api_response)
58
  except ApiException as e:
59
- print("Exception when calling SMTPApi->send_transac_email: %s\n" % e)
 
 
37
  api_instance = sib_api_v3_sdk.TransactionalEmailsApi(sib_api_v3_sdk.ApiClient(configuration))
38
 
39
  data = mail_body(generation_details)
40
+ p_attachment = create_attachment(private_key.encode('utf-8'), "private.key")
41
+ c_attachment = create_attachment(csr.encode('utf-8'), "domain.csr")
42
+ s_attachment = create_attachment(cert.encode('utf-8'), "certificate.crt")
43
 
44
  subject = "Project Gatekeeper - Your SSL Certificate is ready!"
45
  sender = {"name": "Project Gatekeeper", "email": "gatekeeper@raannakasturi.eu.org"}
 
54
  send_smtp_email = sib_api_v3_sdk.SendSmtpEmail(to=to, reply_to=reply_to, attachment=attachments, text_content=text_content, sender=sender, subject=subject)
55
  try:
56
  api_response = api_instance.send_transac_email(send_smtp_email)
57
+ return True
58
  except ApiException as e:
59
+ print("Exception when calling SMTPApi->send_transac_email: %s\n" % e)
60
+ return False