code: def sendTemplate(mailer, sender, recipient, template, context, hook=_nop):
      
      headers, parts = template.evaluate(context)
      headers["From"] = sender
      headers["To"] = recipient
      hook(headers, parts)
  
      content = mime.buildMessage(headers, parts)
      return mailer.send(sender, recipient, content)
docs: Simple case for sending some e-mail using a template.