本文整理汇总了Python中smtpd.SMTPServer方法的典型用法代码示例。如果您正苦于以下问题:Python smtpd.SMTPServer方法的具体用法?Python smtpd.SMTPServer怎么用?Python smtpd.SMTPServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smtpd
的用法示例。
在下文中一共展示了smtpd.SMTPServer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, *args, **kw):
self._extra_features = []
smtpd.SMTPServer.__init__(self, *args, **kw)
示例2: __init__
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self):
localaddr = settings.LMTP_HOST, int(settings.LMTP_PORT)
log.info("lmtp_server_start", address=localaddr)
smtpd.SMTPServer.__init__(self, localaddr, remoteaddr=None)
super().__init__()
示例3: __init__
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, debug=False, esmtp=True):
super(SMTPServer, self).__init__()
self.esmtp = esmtp
self.debug = debug
self._server = None
self._wait_for_server = threading.Semaphore(0)
示例4: stop
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def stop(self):
self._server.close()
super(SMTPServer, self).stop()
示例5: __init__
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, *args, **kwargs):
smtpd.SMTPServer.__init__(self, *args, **kwargs)
self.messages = []
if self._decode_data:
self.return_status = 'return status'
else:
self.return_status = b'return status'
示例6: test_process_message_unimplemented
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def test_process_message_unimplemented(self):
server = smtpd.SMTPServer((support.HOST, 0), ('b', 0),
decode_data=True)
conn, addr = server.accept()
channel = smtpd.SMTPChannel(server, conn, addr, decode_data=True)
def write_line(line):
channel.socket.queue_recv(line)
channel.handle_read()
write_line(b'HELO example')
write_line(b'MAIL From:eggs@example')
write_line(b'RCPT To:spam@example')
write_line(b'DATA')
self.assertRaises(NotImplementedError, write_line, b'spam\r\n.\r\n')
示例7: test_decode_data_default_warns
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def test_decode_data_default_warns(self):
with self.assertWarns(DeprecationWarning):
smtpd.SMTPServer((support.HOST, 0), ('b', 0))
示例8: test_socket_uses_IPv6
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def test_socket_uses_IPv6(self):
server = smtpd.SMTPServer((support.HOSTv6, 0), (support.HOST, 0),
decode_data=False)
self.assertEqual(server.socket.family, socket.AF_INET6)
示例9: test_socket_uses_IPv4
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def test_socket_uses_IPv4(self):
server = smtpd.SMTPServer((support.HOST, 0), (support.HOSTv6, 0),
decode_data=False)
self.assertEqual(server.socket.family, socket.AF_INET)
示例10: __init__
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, addr, handler, poll_interval, sockmap):
smtpd.SMTPServer.__init__(self, addr, None, map=sockmap,
decode_data=True)
self.port = self.socket.getsockname()[1]
self._handler = handler
self._thread = None
self.poll_interval = poll_interval
示例11: __init__
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, localaddr, remoteaddr):
smtpd.SMTPServer.__init__(self, localaddr, remoteaddr)
self.messages = []
示例12: test_process_message_unimplemented
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def test_process_message_unimplemented(self):
server = smtpd.SMTPServer('a', 'b')
conn, addr = server.accept()
channel = smtpd.SMTPChannel(server, conn, addr)
def write_line(line):
channel.socket.queue_recv(line)
channel.handle_read()
write_line(b'HELO example')
write_line(b'MAIL From:eggs@example')
write_line(b'RCPT To:spam@example')
write_line(b'DATA')
self.assertRaises(NotImplementedError, write_line, b'spam\r\n.\r\n')
示例13: __init__
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, addr, handler, poll_interval, sockmap):
smtpd.SMTPServer.__init__(self, addr, None, map=sockmap)
self.port = self.socket.getsockname()[1]
self._handler = handler
self._thread = None
self.poll_interval = poll_interval
示例14: __init__
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, *args, **kwargs):
self.messages = []
smtpd.SMTPServer.__init__(self, *args, **kwargs)
示例15: __init__
# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, *args, **kwargs):
threading.Thread.__init__(self)
# New kwarg added in Python 3.5; default switching to False in 3.6.
# Setting a value only silences a deprecation warning in Python 3.5.
kwargs['decode_data'] = True
smtpd.SMTPServer.__init__(self, *args, **kwargs)
self._sink = []
self.active = False
self.active_lock = threading.Lock()
self.sink_lock = threading.Lock()