code: def render_mail(self, template_prefix, email, context):
          
          subject = render_to_string('{0}_subject.txt'.format(template_prefix),
                                     context)
          # remove superfluous line breaks
          subject = " ".join(subject.splitlines()).strip()
          subject = self.format_email_subject(subject)
  
          bodies = {}
          for ext in ['html', 'txt']:
              try:
                  template_name = '{0}_message.{1}'.format(template_prefix, ext)
                  bodies[ext] = render_to_string(template_name,
                                                 context).strip()
              except TemplateDoesNotExist:
                  if ext == 'txt' and not bodies:
                      # We need at least one body
                      raise
          if 'txt' in bodies:
              msg = EmailMultiAlternatives(subject,
                                           bodies['txt'],
                                           settings.DEFAULT_FROM_EMAIL,
                                           [email])
              if 'html' in bodies:
                  msg.attach_alternative(bodies['html'], 'text/html')
          else:
              msg = EmailMessage(subject,
                                 bodies['html'],
                                 settings.DEFAULT_FROM_EMAIL,
                                 [email])
              msg.content_subtype = 'html'  # Main content is now text/html
          return msg
docs: Renders an e-mail to `email`.  `template_prefix` identifies the
          e-mail that is to be sent, e.g. "account/email/email_confirmation"