Exemplo n.º 1
0
    def Send(self, text):
        # Geheimen inladen
        smtp = self.config["Runtime"]["secrets"]["email_server"]
        user = self.config["Runtime"]["secrets"]["email_username"]
        password = self.config["Runtime"]["secrets"]["email_password"]

        # Verbind met mailserver
        mailserver = smtplib.SMTP(smtp)
        mailserver.ehlo()
        mailserver.starttls()
        mailserver.ehlo()
        mailserver.login(user, password)

        # Mailbericht opbouwen
        message = MIMEMultipart('alternative')

        goede = f.Goede(self.config)

        message['Subject'] = goede
        message['From'] = goede + " <" + user + ">"
        message['To'] = self.emailadres

        html = text
        message.attach(MIMEText(html, "html", "utf-8"))

        # E-mail versturen
        mailserver.sendmail(user, self.emailadres, message.as_string())

        # Verbinding sluiten
        mailserver.close()
Exemplo n.º 2
0
 def Send(self, text):
     pb = Pushbullet(self.config["Pushbullet"]["apikey"])
     pb.push_note(f.Goede(self.config), f.html2plain(text))