def send_mail_template(subject, template, addr_from, addr_to, context=None, attachments=None, fail_silently=None, addr_bcc=None, headers=None):
 if (context is None):
  context = {}
 if (attachments is None):
  attachments = []
 if (fail_silently is None):
  fail_silently = settings.EMAIL_FAIL_SILENTLY
 context.update(context_settings())
 if (isinstance(addr_to, str) or isinstance(addr_to, bytes)):
  addr_to = [addr_to]
 if ((addr_bcc is not None) and (isinstance(addr_bcc, str) or isinstance(addr_bcc, bytes))):
  addr_bcc = [addr_bcc]
 render = (lambda type: loader.get_template((u'%s.%s' % (template, type))).render(Context(context)))
 msg = EmailMultiAlternatives(subject, render(u'txt'), addr_from, addr_to, addr_bcc, headers=headers)
 msg.attach_alternative(render(u'html'), u'text/html')
 for attachment in attachments:
  msg.attach(*attachment)
 msg.send(fail_silently=fail_silently)

def send_mail_template ( subject , template , addr_from , addr_to , context = None , attachments = None , fail_silently = None , addr_bcc = None , headers = None ) : if ( context is None ) : context = { } if ( attachments is None ) : attachments = [ ] if ( fail_silently is None ) : fail_silently = settings . EMAIL_FAIL_SILENTLY context . update ( context_settings ( ) ) if ( isinstance ( addr_to , str ) or isinstance ( addr_to , bytes ) ) : addr_to = [ addr_to ] if ( ( addr_bcc is not None ) and ( isinstance ( addr_bcc , str ) or isinstance ( addr_bcc , bytes ) ) ) : addr_bcc = [ addr_bcc ] render = ( lambda type : loader . get_template ( ( u'%s.%s' % ( template , type ) ) ) . render ( Context ( context ) ) ) msg = EmailMultiAlternatives ( subject , render ( u'txt' ) , addr_from , addr_to , addr_bcc , headers = headers ) msg . attach_alternative ( render ( u'html' ) , u'text/html' ) for attachment in attachments : msg . attach ( * attachment ) msg . send ( fail_silently = fail_silently )
send email rendering text and html versions for the specified template name using the context dictionary passed in .