def send_html_email(sender, send_mail_args=None, context=None, template_html=None ,**kwargs):
    send_html = config_value('SHOP', 'HTML_EMAIL')

    if not send_html:
        return

    # perhaps send_store_mail() was not passed the *template_html* argument
    if not template_html:
        return

    if settings.DEBUG:
        log.info("Attempting to send html mail.")
    try:
        t = loader.get_template(template_html)
        html_body = t.render(context)
    except TemplateDoesNotExist:
        log.warn('Unable to find html email template %s. Falling back to text only email.' % template_html)
        return

    # just like send_store_mail() does
    if not send_mail_args.get('recipient_list'):
        raise NoRecipientsException

    # prepare kwargs for EmailMultiAlternatives()
    fail_silently = send_mail_args.pop('fail_silently')
    send_mail_args['body'] = send_mail_args.pop('message') # the plain text part
    send_mail_args['to'] = send_mail_args.pop('recipient_list')

    msg = EmailMultiAlternatives(**send_mail_args)
    msg.attach_alternative(html_body, "text/html")

    # don't have to handle any errors, as send_store_mail() does so for us.
    msg.send(fail_silently=fail_silently)

    # tell send_store_mail() to abort sending plain text mail
    raise ShouldNotSendMail
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_store/mail.py/send_html_email/original