當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。