当前位置: 首页>>代码示例>>Python>>正文


Python smtpd.SMTPServer方法代码示例

本文整理汇总了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) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:5,代码来源:test_smtplib.py

示例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__() 
开发者ID:webkom,项目名称:lego,代码行数:7,代码来源:service.py

示例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) 
开发者ID:exasol,项目名称:script-languages,代码行数:8,代码来源:__init__.py

示例4: stop

# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def stop(self):
        self._server.close()
        super(SMTPServer, self).stop() 
开发者ID:exasol,项目名称:script-languages,代码行数:5,代码来源:__init__.py

示例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' 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:test_smtpd.py

示例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') 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:17,代码来源:test_smtpd.py

示例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)) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:5,代码来源:test_smtpd.py

示例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) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:6,代码来源:test_smtpd.py

示例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) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:6,代码来源:test_smtpd.py

示例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 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:test_logging.py

示例11: __init__

# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, localaddr, remoteaddr):
        smtpd.SMTPServer.__init__(self, localaddr, remoteaddr)
        self.messages = [] 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:5,代码来源:test_smtpd.py

示例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') 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:16,代码来源:test_smtpd.py

示例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 
开发者ID:IronLanguages,项目名称:ironpython3,代码行数:8,代码来源:test_logging.py

示例14: __init__

# 需要导入模块: import smtpd [as 别名]
# 或者: from smtpd import SMTPServer [as 别名]
def __init__(self, *args, **kwargs):
        self.messages = []
        smtpd.SMTPServer.__init__(self, *args, **kwargs) 
开发者ID:mendersoftware,项目名称:integration,代码行数:5,代码来源:smtpd_mock.py

示例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() 
开发者ID:nesdis,项目名称:djongo,代码行数:12,代码来源:tests.py


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