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

Python client.Client类代码示例

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

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



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

示例1: test_mailfrom_size

 def test_mailfrom_size(self):
     self.sock.sendall(b'MAIL FROM:<test> SIZE=10\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 2.0.0 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     client.extensions.add('SIZE', 100)
     client.mailfrom('test', data_size=10)
开发者ID:you4you4,项目名称:python-slimta,代码行数:7,代码来源:test_slimta_smtp_client.py


示例2: test_get_banner

 def test_get_banner(self):
     self.sock.recv(IsA(int)).AndReturn(b'220 Go\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.get_banner()
     self.assertEqual('220', reply.code)
     self.assertEqual('Go', reply.message)
     self.assertEqual(b'[BANNER]', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_client.py


示例3: test_get_reply

 def test_get_reply(self):
     self.sock.recv(IsA(int)).AndReturn(b'421 Test\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.get_reply(b'[TEST]')
     self.assertEqual('421', reply.code)
     self.assertEqual('4.0.0 Test', reply.message)
     self.assertEqual(b'[TEST]', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:8,代码来源:test_slimta_smtp_client.py


示例4: test_starttls_noencrypt

 def test_starttls_noencrypt(self):
     self.sock.sendall(b"STARTTLS\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"420 Nope\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.starttls({})
     self.assertEqual("420", reply.code)
     self.assertEqual("4.0.0 Nope", reply.message)
     self.assertEqual(b"STARTTLS", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例5: test_custom_command

 def test_custom_command(self):
     self.sock.sendall(b'cmd arg\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.custom_command(b'cmd', b'arg')
     self.assertEqual('250', reply.code)
     self.assertEqual('2.0.0 Ok', reply.message)
     self.assertEqual(b'CMD', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例6: test_send_data

 def test_send_data(self):
     self.sock.sendall(b'One\r\nTwo\r\n..Three\r\n.\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 2.0.0 Done\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.send_data(b'One\r\nTwo\r\n.Three')
     self.assertEqual('250', reply.code)
     self.assertEqual('2.0.0 Done', reply.message)
     self.assertEqual(b'[SEND_DATA]', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例7: test_rcptto

 def test_rcptto(self):
     self.sock.sendall(b"RCPT TO:<test>\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"250 2.0.0 Ok\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.rcptto("test")
     self.assertEqual("250", reply.code)
     self.assertEqual("2.0.0 Ok", reply.message)
     self.assertEqual(b"RCPT", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例8: test_mailfrom

 def test_mailfrom(self):
     self.sock.sendall(b"MAIL FROM:<test>\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"250 2.0.0 Ok\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.mailfrom("test")
     self.assertEqual("250", reply.code)
     self.assertEqual("2.0.0 Ok", reply.message)
     self.assertEqual(b"MAIL", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例9: test_auth_force_mechanism

 def test_auth_force_mechanism(self):
     self.sock.sendall(b'AUTH PLAIN AHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'535 Nope!\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.auth('[email protected]', 'asdf', mechanism=b'PLAIN')
     self.assertEqual('535', reply.code)
     self.assertEqual('5.0.0 Nope!', reply.message)
     self.assertEqual(b'AUTH', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例10: test_starttls_noencrypt

 def test_starttls_noencrypt(self):
     self.sock.sendall('STARTTLS\r\n')
     self.sock.recv(IsA(int)).AndReturn('420 Nope\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.starttls({})
     assert_equal('420', reply.code)
     assert_equal('4.0.0 Nope', reply.message)
     assert_equal('STARTTLS', reply.command)
开发者ID:drewlander,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例11: test_quit

 def test_quit(self):
     self.sock.sendall('QUIT\r\n')
     self.sock.recv(IsA(int)).AndReturn('221 Bye\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.quit()
     assert_equal('221', reply.code)
     assert_equal('2.0.0 Bye', reply.message)
     assert_equal('QUIT', reply.command)
开发者ID:drewlander,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例12: test_rset

 def test_rset(self):
     self.sock.sendall('RSET\r\n')
     self.sock.recv(IsA(int)).AndReturn('250 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.rset()
     assert_equal('250', reply.code)
     assert_equal('2.0.0 Ok', reply.message)
     assert_equal('RSET', reply.command)
开发者ID:drewlander,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例13: test_data

 def test_data(self):
     self.sock.sendall(b'DATA\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'354 Go ahead\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.data()
     self.assertEqual('354', reply.code)
     self.assertEqual('Go ahead', reply.message)
     self.assertEqual(b'DATA', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例14: test_helo

 def test_helo(self):
     self.sock.sendall(b'HELO there\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 Hello\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.helo('there')
     self.assertEqual('250', reply.code)
     self.assertEqual('Hello', reply.message)
     self.assertEqual(b'HELO', reply.command)
开发者ID:you4you4,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例15: test_send_empty_data

 def test_send_empty_data(self):
     self.sock.sendall('.\r\n')
     self.sock.recv(IsA(int)).AndReturn('250 2.0.0 Done\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.send_empty_data()
     assert_equal('250', reply.code)
     assert_equal('2.0.0 Done', reply.message)
     assert_equal('[SEND_DATA]', reply.command)
开发者ID:drewlander,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例16: test_quit

 def test_quit(self):
     self.sock.sendall(b"QUIT\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"221 Bye\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.quit()
     self.assertEqual("221", reply.code)
     self.assertEqual("2.0.0 Bye", reply.message)
     self.assertEqual(b"QUIT", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例17: test_rset

 def test_rset(self):
     self.sock.sendall(b"RSET\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"250 Ok\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     reply = client.rset()
     self.assertEqual("250", reply.code)
     self.assertEqual("2.0.0 Ok", reply.message)
     self.assertEqual(b"RSET", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:9,代码来源:test_slimta_smtp_client.py


示例18: test_mailfrom_auth

 def test_mailfrom_auth(self):
     self.sock.sendall(b'MAIL FROM:<test> AUTH=<>\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 2.0.0 Ok\r\n')
     self.sock.sendall(b'MAIL FROM:<test> AUTH=1+2B1+3D2\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'250 2.0.0 Ok\r\n')
     self.mox.ReplayAll()
     client = Client(self.sock)
     client.extensions.add('AUTH', True)
     client.mailfrom('test', auth=False)
     client.mailfrom('test', auth='1+1=2')
开发者ID:you4you4,项目名称:python-slimta,代码行数:10,代码来源:test_slimta_smtp_client.py


示例19: test_mailfrom_size

 def test_mailfrom_size(self):
     self.sock.sendall(b"MAIL FROM:<test> SIZE=10\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"250 2.0.0 Ok\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     client.extensions.add("SIZE", 100)
     reply = client.mailfrom("test", 10)
     self.assertEqual("250", reply.code)
     self.assertEqual("2.0.0 Ok", reply.message)
     self.assertEqual(b"MAIL", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:10,代码来源:test_slimta_smtp_client.py


示例20: test_auth

 def test_auth(self):
     self.sock.sendall(b"AUTH PLAIN AHRlc3RAZXhhbXBsZS5jb20AYXNkZg==\r\n")
     self.sock.recv(IsA(int)).AndReturn(b"235 Ok\r\n")
     self.mox.ReplayAll()
     client = Client(self.sock)
     client.extensions.add("AUTH", b"PLAIN")
     reply = client.auth("[email protected]", "asdf")
     self.assertEqual("235", reply.code)
     self.assertEqual("2.0.0 Ok", reply.message)
     self.assertEqual(b"AUTH", reply.command)
开发者ID:oasiswork,项目名称:python-slimta,代码行数:10,代码来源:test_slimta_smtp_client.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python datareader.DataReader类代码示例发布时间:2022-05-27
下一篇:
Python auth.AuthSession类代码示例发布时间: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