Send email to cdc on new opening.

This commit is contained in:
Gowtham Sai 2022-08-29 23:07:15 +05:30
parent 59c1842370
commit 9260d121e5
3 changed files with 7 additions and 2 deletions

View File

@ -279,7 +279,7 @@ def verifyEmail(request):
"opening_type": PLACEMENT, "opening_type": PLACEMENT,
"company_name": opening.company_name, "company_name": opening.company_name,
} }
sendEmail(opening.email, COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.id), data, sendEmail([opening.email, CDC_MAIl_ADDRESS], COMPANY_OPENING_SUBMITTED_TEMPLATE_SUBJECT.format(id=opening.id), data,
COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone) COMPANY_OPENING_SUBMITTED_TEMPLATE, attachment_jnf_respone)
return Response({'action': "Verify Email", 'message': "Email Verified Successfully"}, return Response({'action': "Verify Email", 'message': "Email Verified Successfully"},

View File

@ -45,6 +45,8 @@ DEGREE_CHOICES = [
TOTAL_BRANCHES = 4 # Total No of Branches TOTAL_BRANCHES = 4 # Total No of Branches
TOTAL_BATCHES = 5 # Total No of Batches TOTAL_BATCHES = 5 # Total No of Batches
CDC_MAIl_ADDRESS = 'cdc@iitdh.ac.in'
# To be Configured Properly # To be Configured Properly
CLIENT_ID = os.environ.get('GOOGLE_OAUTH_CLIENT_ID') # Google Login Client ID CLIENT_ID = os.environ.get('GOOGLE_OAUTH_CLIENT_ID') # Google Login Client ID

View File

@ -146,6 +146,9 @@ def sendEmail(email_to, subject, data, template, attachment_jnf_response=None):
text_content = strip_tags(html_content) text_content = strip_tags(html_content)
email_from = settings.EMAIL_HOST_USER email_from = settings.EMAIL_HOST_USER
if type(email_to) is list:
recipient_list = [str(email) for email in email_to]
else:
recipient_list = [str(email_to), ] recipient_list = [str(email_to), ]
msg = EmailMultiAlternatives(subject, text_content, email_from, recipient_list) msg = EmailMultiAlternatives(subject, text_content, email_from, recipient_list)