@task(queue='web', time_limit=EMAIL_TIME_LIMIT)
def send_email_task(recipient, subject, template, template_html, context=None):
 msg = EmailMultiAlternatives(subject, get_template(template).render(context), settings.DEFAULT_FROM_EMAIL, [recipient])
 try:
  msg.attach_alternative(get_template(template_html).render(context), 'text/html')
 except TemplateDoesNotExist:
  pass
 msg.send()
 log.info('Sent email to recipient: %s', recipient)

@ task ( queue = 'web' , time_limit = EMAIL_TIME_LIMIT ) def send_email_task ( recipient , subject , template , template_html , context = None ) : msg = EmailMultiAlternatives ( subject , get_template ( template ) . render ( context ) , settings . DEFAULT_FROM_EMAIL , [ recipient ] ) try : msg . attach_alternative ( get_template ( template_html ) . render ( context ) , 'text/html' ) except TemplateDoesNotExist : pass msg . send ( ) log . info ( 'Sent email to recipient: %s' , recipient )
send multipart email recipient email recipient address subject email subject header template plain text template to send template_html html template to send as new message part context a dictionary to pass into the template calls .