server.py 文件源码

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

项目:jawaf 作者: danpozmanter 项目源码 文件源码
def init_smtp(self):
        """Initialize smtp connection"""
        if not 'SMTP' in settings:
            return
        smtp_blueprint = Blueprint(f'{self.name}_smtp_blueprint')
        @smtp_blueprint.listener('before_server_start')
        async def connect_smtp(app, loop):
            if settings.SMTP.get('ssl', False):
                self._smtp = SMTP_SSL(hostname=settings.SMTP['host'], port=settings.SMTP['port'])
            else:
                self._smtp = SMTP(hostname=settings.SMTP['host'], port=settings.SMTP['port'])
            await self._smtp.connect()
            if 'username' in settings.SMTP and 'password' in settings.SMTP:
                await self._smtp.auth.auth(settings.SMTP['username'], settings.SMTP['password'])
        self.server.blueprint(smtp_blueprint)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号