mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-14 09:37:20 +00:00
added task to send otp on email
This commit is contained in:
29
base/tasks.py
Normal file
29
base/tasks.py
Normal file
@ -0,0 +1,29 @@
|
||||
"""
|
||||
web_admin tasks file
|
||||
"""
|
||||
# third party imports
|
||||
from celery import shared_task
|
||||
from templated_email import send_templated_mail
|
||||
|
||||
# django imports
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
@shared_task
|
||||
def send_email_otp(email, verification_code):
|
||||
"""
|
||||
used to send otp on email
|
||||
:param email: e-mail
|
||||
:param verification_code: otp
|
||||
"""
|
||||
from_email = settings.EMAIL_FROM_ADDRESS
|
||||
recipient_list = [email]
|
||||
send_templated_mail(
|
||||
template_name='email_reset_verification.email',
|
||||
from_email=from_email,
|
||||
recipient_list=recipient_list,
|
||||
context={
|
||||
'verification_code': verification_code
|
||||
}
|
||||
)
|
||||
return True
|
Reference in New Issue
Block a user