-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.py
More file actions
16 lines (15 loc) · 679 Bytes
/
task.py
File metadata and controls
16 lines (15 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils.html import strip_tags
from django.conf import settings
from caffeinecode.celery import app
from Config.logger import serverLogger
@app.task
def SendOTP(email,otp):
html_content = render_to_string("IndexHome/email.html",{'otp':otp,'email':email})
text_content = strip_tags(html_content)
email_con = EmailMultiAlternatives('Verfication Code - CaffeineCode',text_content,settings.EMAIL_HOST_USER,[email])
email_con.attach_alternative(html_content,"text/html")
email_con.send()
serverLogger("success","Mail Sent!!")
return "Done"