kz26 / mailproxy

mailproxy is a simple SMTP proxy. It receives emails through an unencrypted, unauthenticated SMTP interface and retransmits them through a remote SMTP server that requires modern features such as encryption and/or authentication. mailproxy is primarily useful for enabling email functionality in legacy software that only supports plain SMTP.
MIT License
196 stars 28 forks source link

Parsing Problems with Python 3.9 #6

Open chtugha opened 3 years ago

chtugha commented 3 years ago

Hi, i get following errors trying to run your script with windows

Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved.

C:\Program Files\mailproxy-master>python mailproxy.py ('127.0.0.1', 49304) SMTP session exception Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-p ackages\aiosmtpd\smtp.py", line 647, in _handle_client await method(arg) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-p ackages\aiosmtpd\smtp.py", line 1358, in smtp_DATA status = await self._call_handler_hook('DATA') File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-p ackages\aiosmtpd\smtp.py", line 415, in _call_handler_hook status = await hook(self, self.session, self.envelope, *args) File "C:\Program Files\mailproxy-master\mailproxy.py", line 26, in handle_DATA

refused = self._deliver(envelope)

File "C:\Program Files\mailproxy-master\mailproxy.py", line 45, in _deliver s.connect(self._host, self._port) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\smtpli b.py", line 339, in connect self.sock = self._get_socket(host, port, self.timeout) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\smtpli b.py", line 1041, in _get_socket new_socket = self.context.wrap_socket(new_socket, File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\ssl.py ", line 500, in wrap_socket return self.sslsocket_class._create( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\ssl.py ", line 1031, in _create self._sslobj = self._context._wrap_socket( ValueError: server_hostname cannot be an empty string or start with a leading do t.

ibv commented 2 years ago

Hi, for starttls at me this helped https://stackoverflow.com/questions/51768041/python3-smtp-valueerror-server-hostname-cannot-be-an-empty-string-or-start-with

s = smtplib.SMTP(self._host)

s.connect(self._host, self._port)

dancysoft commented 2 years ago

@chtugha I have a fork of this repository at https://github.com/dancysoft/mailproxy which has the fix suggested by @ibv.