def send_email(request, context, subject_template, body_template,<EOL>from_email, recipients, priority="<STR_LIT>", reply_to=None,<EOL>headers=None, cc=None, bcc=None):
headers = headers or {}<EOL>if not reply_to:<EOL><INDENT>reply_to = from_email<EOL><DEDENT>if hasattr(settings, '<STR_LIT>'):<EOL><INDENT>context_fn = load_member_from_setting('<STR_LIT>')<EOL>context.update(context_fn(request))<EOL><DEDENT>if request and request.get_host():<EOL><INDENT>domain = request.get_host()<EOL>protocol = '<STR_LIT>' if request.is_secure() else '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>domain = getattr(settings, '<STR_LIT>', Site.objects.get_current().domain)<EOL>protocol = getattr(settings, '<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>context.update({<EOL>'<STR_LIT>': domain,<EOL>'<STR_LIT>': protocol,<EOL>})<EOL>subject = render_to_string(template_name=subject_template,<EOL>context=context, request=request)<EOL>subject = '<STR_LIT>'.join(subject.splitlines())<EOL>message_html = render_to_string(template_name=body_template,<EOL>context=context, request=request)<EOL>message_plaintext = html_to_plain_text(message_html)<EOL>subject = force_text(subject)<EOL>message = force_text(message_plaintext)<EOL>email = EmailMultiAlternatives(<EOL>subject=subject,<EOL>body=message,<EOL>from_email=from_email,<EOL>to=recipients,<EOL>cc=cc,<EOL>bcc=bcc,<EOL>headers=headers,<EOL>reply_to=[reply_to],<EOL>)<EOL>email.attach_alternative(message_html, "<STR_LIT>")<EOL>if settings.EMAIL_BACKEND == '<STR_LIT>':<EOL><INDENT>priority = mailer.get_priority(priority)<EOL>msg = make_message(<EOL>subject=subject,<EOL>body=message,<EOL>from_email=from_email,<EOL>to=recipients,<EOL>priority=priority,<EOL>)<EOL>msg.email = email<EOL>msg.save()<EOL><DEDENT>else:<EOL><INDENT>email.send()<EOL><DEDENT>
Sends an email based on templates for subject and body.

:param request: The current request instance.
:param context: A dictionary of items that should be added to the
    templates' contexts.
:param subject_template: A string representing the path to the template of
    of the email's subject.
:param body_template: A string representing the path to the template of
    the email's body.
:param from_email: String that represents the sender of the email.
:param recipients: A list of tuples of recipients. The tuples are similar
    to the ADMINS setting.
:param priority: Sets the priority of the email (only used by django-mailer
    to prioritise email sendings).
:param reply_to: Optional email address to reply to.
:param headers: Additional dictionary to add header attributes.
:param cc: A list of CC recipients
:param bcc: A list of BCC recipients