mail sent from django.core.mail import EmailMessage from django.template.loader import render_to_string from threading import Thread def send_email_threaded(otp, recipient_email): """Helper function to send email asynchronously in a separate thread.""" try: # Render the HTML template with the OTP html_content = render_to_string( 'otp_email_template.html', {'otp': otp} ) # Create the email object email = EmailMessage( subject="Your OTP for Login", # Email subject body=html_content, # HTML content for the email ...
Comments
Post a Comment