bcoe / secure-smtpd

Fork of Python's standard SMTP server. Adding support for various extensions to the protocol.
ISC License
128 stars 42 forks source link

Error When AUTH #32

Open hang333 opened 8 years ago

hang333 commented 8 years ago

My code: ` import logging from secure_smtpd import SMTPServer, FakeCredentialValidator, LOG_NAME

class SSLSMTPServer(SMTPServer): def process_message(self, peer, mailfrom, rcpttos, message_data): print(message_data)

logger = logging.getLogger( LOG_NAME ) logger.setLevel(logging.INFO)

server = SSLSMTPServer( ('0.0.0.0', 4896), None, require_authentication=True, ssl=False, credential_validator=FakeCredentialValidator(), maximum_execution_time = 1.0 )

server.run() `

ERROR: error: uncaptured python exception, closing channel <__main__.SSLSMTPServer listening 0.0.0.0:4896 at 0x2e3e108> (<class 'pickle.PicklingError'>:Can't pickle <built-in method recvfrom_into of _socket.socket object at 0x0000000002E3E130>: it's not found as __main__.recvfrom_into [C:\Python27\lib\asyncore.py|read|83] [C:\Python27\lib\asyncore.py|handle_read_event|443] [C:\Python27\lib\site-packages\secure_smtpd-3.0.0-py2.7.egg\secure_smtpd\smtp_server.py|handle_accept|31] [C:\Python27\lib\site-packages\secure_smtpd-3.0.0-py2.7.egg\secure_smtpd\process_pool.py|__init__|10] [C:\Python27\lib\site-packages\secure_smtpd-3.0.0-py2.7.egg\secure_smtpd\process_pool.py|_create_processes|16] [C:\Python27\lib\multiprocessing\process.py|start|130] [C:\Python27\lib\multiprocessing\forking.py|__init__|277] [C:\Python27\lib\multiprocessing\forking.py|dump|199] [C:\Python27\lib\pickle.py|dump|224] [C:\Python27\lib\pickle.py|save|331] [C:\Python27\lib\pickle.py|save_reduce|425] [C:\Python27\lib\pickle.py|save|286] [C:\Python27\lib\pickle.py|save_dict|655] [C:\Python27\lib\pickle.py|_batch_setitems|687] [C:\Python27\lib\pickle.py|save|286] [C:\Python27\lib\multiprocessing\forking.py|dispatcher|67] [C:\Python27\lib\pickle.py|save_reduce|401] [C:\Python27\lib\pickle.py|save|286] [C:\Python27\lib\pickle.py|save_tuple|554] [C:\Python27\lib\pickle.py|save|286] [C:\Python27\lib\pickle.py|save_inst|731] [C:\Python27\lib\pickle.py|save|286] [C:\Python27\lib\pickle.py|save_dict|655] [C:\Python27\lib\pickle.py|_batch_setitems|687] [C:\Python27\lib\pickle.py|save|331] [C:\Python27\lib\pickle.py|save_reduce|425] [C:\Python27\lib\pickle.py|save|286] [C:\Python27\lib\pickle.py|save_tuple|554] [C:\Python27\lib\pickle.py|save|286] [C:\Python27\lib\pickle.py|save_dict|655] [C:\Python27\lib\pickle.py|_batch_setitems|687] [C:\Python27\lib\pickle.py|save|286] [C:\Python27\lib\pickle.py|save_global|754])

rodossaenz commented 8 years ago

Hi guys, I am facing this issue message: SMTP AUTH extension not supported by server. Could you help me what is wrong?

My Server

 import logging
 from secure_smtpd import SMTPServer, FakeCredentialValidator, LOG_NAME

 class SSLSMTPServer(SMTPServer):

    def __init__(self):
        pass
    def process_message(self, peer, mailfrom, rcpttos, message_data):
        print(message_data)

    def start(self):
        logger = logging.getLogger(LOG_NAME)
        logger.setLevel(logging.INFO)

        print "Secure SMTP Server Starting . . ."

        SMTPServer.__init__(
            self,
            ('127.0.0.1', 465),
            None,
            require_authentication=True,
            ssl=True,
            certfile='examples/server.crt',
            keyfile='examples/server.key',
            credential_validator=FakeCredentialValidator(),
            maximum_execution_time=1.0
            )
        print "Secure SMTP Server Ready!"
        server.run()

server = SSLSMTPServer()
server.start()

My Client

import smtplib

msg = """From: foo@localhost
To: bar@localhost

Here's my message!
"""

server = smtplib.SMTP_SSL('127.0.0.1', port=465)
server.set_debuglevel(1)
server.login('bcoe', 'foobar')
server.sendmail('foo@localhost', ['bar@localhost'], msg)
server.quit()

My Client Result

Traceback (most recent call last):
  File "examples/ssl_client.py", line 11, in <module>
    server.login('bcoe', 'foobar')
  File "/usr/lib/python2.7/smtplib.py", line 585, in login
    raise SMTPException("SMTP AUTH extension not supported by server.")
smtplib.SMTPException: SMTP AUTH extension not supported by server.