Simple case for sending some e-mail using a template.

def sendTemplate(mailer, sender, recipient, template, context, hook=_nop):
    """
    Simple case for sending some e-mail using a template.
    """
    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)