• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mx.MxSmtpRelay类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中slimta.relay.smtp.mx.MxSmtpRelay的典型用法代码示例。如果您正苦于以下问题:Python MxSmtpRelay类的具体用法?Python MxSmtpRelay怎么用?Python MxSmtpRelay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了MxSmtpRelay类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_choose_mx

 def test_choose_mx(self):
     records = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)]
     mx = MxSmtpRelay()
     self.assertEqual(1, mx.choose_mx(records, 0))
     self.assertEqual(5, mx.choose_mx(records, 4))
     self.assertEqual(1, mx.choose_mx(records, 5))
     self.assertEqual(3, mx.choose_mx(records, 7))
     self.assertEqual(2, mx.choose_mx(records, 1821))
开发者ID:RoboticCheese,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_relay_smtp_mx.py


示例2: test_attempt_no_answer

 def test_attempt_no_answer(self):
     env = Envelope("[email protected]", ["[email protected]"])
     mx = MxSmtpRelay()
     self.mox.StubOutWithMock(mx, "new_static_relay")
     self.mox.StubOutWithMock(dns_resolver, "query")
     dns_resolver.query("example.com", "MX").AndRaise(DNSTimeout)
     self.mox.ReplayAll()
     with assert_raises(TransientRelayError):
         mx.attempt(env, 0)
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_relay_smtp_mx.py


示例3: test_attempt_no_answer

 def test_attempt_no_answer(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx = MxSmtpRelay()
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     self.mox.StubOutWithMock(dns_resolver, 'query')
     dns_resolver.query('example.com', 'MX').AndRaise(DNSTimeout)
     self.mox.ReplayAll()
     with self.assertRaises(TransientRelayError):
         mx.attempt(env, 0)
开发者ID:sk1p,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_relay_smtp_mx.py


示例4: test_attempt_no_records

 def test_attempt_no_records(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     self.mox.StubOutWithMock(dns.resolver, 'query')
     dns.resolver.query('example.com', 'MX').AndRaise(dns.resolver.NXDOMAIN)
     dns.resolver.query('example.com', 'A').AndRaise(dns.resolver.NXDOMAIN)
     self.mox.ReplayAll()
     with self.assertRaises(PermanentRelayError):
         mx.attempt(env, 0)
开发者ID:rafaelnovello,项目名称:python-slimta,代码行数:11,代码来源:test_slimta_relay_smtp_mx.py


示例5: test_attempt_no_records

 def test_attempt_no_records(self):
     env = Envelope("[email protected]", ["[email protected]"])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, "new_static_relay")
     self.mox.StubOutWithMock(dns_resolver, "query")
     dns_resolver.query("example.com", "MX").AndRaise(dns.resolver.NXDOMAIN)
     dns_resolver.query("example.com", "A").AndRaise(dns.resolver.NXDOMAIN)
     self.mox.ReplayAll()
     with assert_raises(PermanentRelayError):
         mx.attempt(env, 0)
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:11,代码来源:test_slimta_relay_smtp_mx.py


示例6: test_attempt_no_mx

 def test_attempt_no_mx(self):
     env = Envelope('[email protected]', ['[email protected]'])
     a_ret = FakeAAnswer(False, [('1.2.3.4', )])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     self.mox.StubOutWithMock(dns.resolver, 'query')
     dns.resolver.query('example.com', 'MX').AndRaise(dns.resolver.NXDOMAIN)
     dns.resolver.query('example.com', 'A').AndReturn(a_ret)
     mx.new_static_relay('1.2.3.4', 25).AndReturn(static)
     static.attempt(env, 0)
     self.mox.ReplayAll()
     mx.attempt(env, 0)
开发者ID:rafaelnovello,项目名称:python-slimta,代码行数:13,代码来源:test_slimta_relay_smtp_mx.py


示例7: test_attempt_no_mx

 def test_attempt_no_mx(self):
     env = Envelope("[email protected]", ["[email protected]"])
     a_ret = FakeAAnswer(False, [("1.2.3.4",)])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, "new_static_relay")
     self.mox.StubOutWithMock(dns_resolver, "query")
     dns_resolver.query("example.com", "MX").AndRaise(dns.resolver.NXDOMAIN)
     dns_resolver.query("example.com", "A").AndReturn(a_ret)
     mx.new_static_relay("1.2.3.4", 25).AndReturn(static)
     static.attempt(env, 0)
     self.mox.ReplayAll()
     mx.attempt(env, 0)
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:13,代码来源:test_slimta_relay_smtp_mx.py


示例8: test_attempt_force_mx

 def test_attempt_force_mx(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     mx.new_static_relay('mail.example.com', 25).AndReturn(static)
     static.attempt(env, 0)
     static.attempt(env, 1)
     self.mox.ReplayAll()
     mx.force_mx('example.com', 'mail.example.com')
     mx.attempt(env, 0)
     mx.attempt(env, 1)
开发者ID:RoboticCheese,项目名称:python-slimta,代码行数:12,代码来源:test_slimta_relay_smtp_mx.py


示例9: test_attempt

 def test_attempt(self):
     env = Envelope("[email protected]", ["[email protected]"])
     mx_ret = FakeMxAnswer(False, [(5, "mx1.example.com"), (10, "mx2.example.com")])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, "new_static_relay")
     self.mox.StubOutWithMock(dns_resolver, "query")
     dns_resolver.query("example.com", "MX").AndReturn(mx_ret)
     mx.new_static_relay("mx1.example.com", 25).AndReturn(static)
     static.attempt(env, 0)
     mx.new_static_relay("mx2.example.com", 25).AndReturn(static)
     static.attempt(env, 1)
     self.mox.ReplayAll()
     mx.attempt(env, 0)
     mx.attempt(env, 1)
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:15,代码来源:test_slimta_relay_smtp_mx.py


示例10: test_attempt

 def test_attempt(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx_ret = FakeMxAnswer(False, [(5, 'mx1.example.com'),
                                   (10, 'mx2.example.com')])
     mx = MxSmtpRelay()
     static = self.mox.CreateMock(StaticSmtpRelay)
     self.mox.StubOutWithMock(mx, 'new_static_relay')
     self.mox.StubOutWithMock(dns.resolver, 'query')
     dns.resolver.query('example.com', 'MX').AndReturn(mx_ret)
     mx.new_static_relay('mx1.example.com', 25).AndReturn(static)
     static.attempt(env, 0)
     mx.new_static_relay('mx2.example.com', 25).AndReturn(static)
     static.attempt(env, 1)
     self.mox.ReplayAll()
     mx.attempt(env, 0)
     mx.attempt(env, 1)
开发者ID:RoboticCheese,项目名称:python-slimta,代码行数:16,代码来源:test_slimta_relay_smtp_mx.py


示例11: test_get_rcpt_domain

 def test_get_rcpt_domain(self):
     env = Envelope('[email protected]', ['[email protected]'])
     mx = MxSmtpRelay()
     self.assertEqual('example.com', mx._get_rcpt_domain(env))
开发者ID:RoboticCheese,项目名称:python-slimta,代码行数:4,代码来源:test_slimta_relay_smtp_mx.py


示例12: test_get_rcpt_domain

 def test_get_rcpt_domain(self):
     env = Envelope("[email protected]", ["[email protected]"])
     mx = MxSmtpRelay()
     assert_equal("example.com", mx._get_rcpt_domain(env))
开发者ID:rgcarrasqueira,项目名称:python-slimta,代码行数:4,代码来源:test_slimta_relay_smtp_mx.py



注:本文中的slimta.relay.smtp.mx.MxSmtpRelay类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python auth.AuthSession类代码示例发布时间:2022-05-27
下一篇:
Python lmtpclient.LmtpRelayClient类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap