task queue
#pip install django-background-tasks
from background_task import background
# schedule = 60 second * 5 : Task will perform after 300 second
@background(schedule=60*5)
def send_html_mail_post(id, template):
u = User.objects.get(id=id)
user_email = u.email
subject = "anything"
html_content = template.format(arguments)
from_email, to = from_email, user_email
text_content = ''
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send()
send_html_mail(1,'Hello this is the test email')