Ejemplo n.º 1
0
def send():
    """Send last backup to admins via email."""
    files = get_all_backups()
    if files:
        last = list(sorted(files, reverse=True))[0]
        with open(last, "rb") as fp:
            msg = Message(
                sender=app.config["PRIMARY_MAIL"],
                recipients=app.config["ADMIN_MAILS"],
                subject="[Sprachenzentrum] Backup {}".format(last),
                charset="utf-8",
            )
            mime = mime_from_filepointer(fp)
            data = fp.read()
            msg.attach(last, mime, data)
            mail.send(msg)
Ejemplo n.º 2
0
def send_quick(self, msg):
    try:
        mail.send(msg)
    except Exception as e:
        raise self.retry(exc=e)