mail.py 文件源码

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

项目:nokia-deployer 作者: nokia 项目源码 文件源码
def start(self):
        smtp = smtplib.SMTP(self.mta)
        while self.running:
            try:
                (sender, receivers, subject, message, attachments) = MAIL_QUEUE.get(block=True, timeout=2)
                self._send_mail(smtp, sender, receivers, subject, message, attachments)
            except Empty:
                pass
            except smtplib.SMTPServerDisconnected:
                # Reconnect and retry once
                smtp.connect(self.mta)
                self._send_mail(smtp, sender, receivers, subject, message, attachments)
            except Exception:
                logger.exception("Unhandled exception in mail thread")
        smtp.quit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号