summaryrefslogtreecommitdiffstats
path: root/accounts/backend/mail/__init__.py
blob: ecd0d4512e3dbe1acf0ac49520485bc7b1b6ea25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- coding: utf-8 -*-

class Backend(object):

    def __init__(self, app):
        self.app = app

    def _send(self, recipient, content):
        raise NotImplementedError()

    def send(self, recipient, template, **kwargs):
        if recipient is None:
            return

        tmpl = self.app.jinja_env.get_or_select_template(template)

        kwargs['recipient'] = recipient
        module = tmpl.make_module(kwargs)

        self._send(recipient, module)