~homeworkprod/byceps

ref: 6083c64abf465c011eb6b8963e0fd7d010da0d58 byceps/byceps/email.py -rw-r--r-- 547 bytes
6083c64a — Jochen Kupperschmidt Pre-select bank transfer as the default payment method for orders in the mark-as-paid form 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
byceps.email
~~~~~~~~~~~~

Sending e-mail.

:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

from typing import List

from flask_mail import Mail


_mail = Mail()


def init_app(app):
    _mail.init_app(app)


def send(sender: str, recipients: List[str], subject: str, body: str) -> None:
    """Assemble and send an e-mail."""
    message = {
        'sender': sender,
        'recipients': recipients,
        'subject': subject,
        'body': body,
    }

    _mail.send_message(**message)