tornadomail提供异步电子邮件发送库龙卷风。港口django.mail的。
安装
从来源:'混帐混帐克隆://github.com/equeny/tornadomail.git;光盘tornadomail;蟒蛇setup.py install`
用法
EmailMessage,EmailMultiAlternatives几乎相同的Django类,除了发送功能是异步,并可以接收回调参数。
   从tornadomail.message进口EmailMessage,EmailMultiAlternatives
   从tornadomail.backends.smtp进口EmailBackend
   类应用(tornado.web.Application):
        @property
       高清mail_connection(个体经营):
           返回EmailBackend(
                'smtp.gmail.com',587',','',
               真
            )
   类MainHandler(tornado.web.RequestHandler):
        @property
       高清mail_connection(个体经营):
           回报self.application.mail_connection
        DEF得到(个体经营):
            self.render(“的index.html”)
       高清后期(个体经营):
           高清_finish(NUM):
               打印'sended%D消息(S)“%NUM
                self.render(“的index.html”)
           消息= EmailMessage(
                self.get_argument(“主题”),
                self.get_argument(“信息”),
                '',
                [self.get_argument(“电子邮件”),
               连接= self.mail_connection
            )
&NBSP,           message.send()#回调= _finish)
            self.render(“的index.html”)
要求:
- 在Python中
- 旋风
评论没有发现