mailer.py 文件源码

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

项目:abusehelper 作者: Exploit-install 项目源码 文件源码
def _connect(self, host, port, retry_interval=60.0):
        server = None

        while server is None:
            self.log.info(u"Connecting to SMTP server {0!r} port {1}".format(host, port))
            try:
                server = yield idiokit.thread(
                    SMTP, host, port,
                    ca_certs=self.smtp_ca_certs,
                    timeout=self.smtp_connection_timeout
                )
            except (socket.error, smtplib.SMTPException) as exc:
                self.log.error(u"Failed connecting to SMTP server: {0}".format(utils.format_exception(exc)))
            else:
                self.log.info(u"Connected to the SMTP server")
                break

            self.log.info(u"Retrying SMTP connection in {0:.2f} seconds".format(retry_interval))
            yield idiokit.sleep(retry_interval)

        idiokit.stop(server)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号