hooks.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:PolyArchiv 作者: d9pouces 项目源码 文件源码
def call(self, when, cm, collect_point_results, backup_point_results):
        self.set_extra_variables(cm, collect_point_results, backup_point_results)
        msg = MIMEText(self.format_value(self.content))
        # me == the sender's email address
        # you == the recipient's email address
        msg['Subject'] = self.format_value(self.subject)
        msg['From'] = self.format_value(self.sender)
        msg['To'] = self.format_value(self.recipient)

        # Send the message via our own SMTP server.
        if self.encryption == "tls":
            smtp = smtplib.SMTP_SSL(host=self.hostname, port=self.port, keyfile=self.keyfile, certfile=self.certfile)
        else:
            smtp = smtplib.SMTP(host=self.hostname, port=self.port)
        if self.encryption == 'starttls':
            smtp.starttls(keyfile=self.keyfile, certfile=self.certfile)
        if self.username and self.password:
            smtp.login(self.username, self.password)
        smtp.send_message(msg)
        smtp.quit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号