Skip to content

Instantly share code, notes, and snippets.

@malexmave
Created March 18, 2014 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malexmave/9628006 to your computer and use it in GitHub Desktop.
Save malexmave/9628006 to your computer and use it in GitHub Desktop.
secure-smtpd exceptions
import asyncore
from secure_smtpd import ProxyServer
class MyProxyServer(ProxyServer):
def process_message(self, peer, mailfrom, rcpttos, data):
ProxyServer.process_message(self, peer, mailfrom, rcpttos, data)
def run():
foo = MyProxyServer(("localhost", 2525),
("smtp.target-host.tld", 465),
ssl_out_only=True)
try:
asyncore.loop()
except KeyboardInterrupt:
pass
if __name__ == '__main__':
run()
error: uncaptured python exception, closing channel <secure_smtpd.smtp_channel.SMTPChannel connected 127.0.0.1:42381 at 0x7f12575068c0> (<type 'exceptions.NameError'>:global name 'socket' is not defined [/usr/lib/python2.7/asyncore.py|read|83] [/usr/lib/python2.7/asyncore.py|handle_read_event|449] [/usr/lib/python2.7/asynchat.py|handle_read|158] [/usr/local/lib/python2.7/dist-packages/secure_smtpd-1.1.9-py2.7.egg/secure_smtpd/smtp_channel.py|found_terminator|123] [test.py|process_message|17] [/usr/local/lib/python2.7/dist-packages/secure_smtpd-1.1.9-py2.7.egg/secure_smtpd/proxy_server.py|process_message|55] [/usr/local/lib/python2.7/dist-packages/secure_smtpd-1.1.9-py2.7.egg/secure_smtpd/proxy_server.py|_deliver|84])
@dnmgns
Copy link

dnmgns commented Sep 20, 2015

I see that you created this gist a long time ago Malex. But do you remember if you did ever resolve this? I'm running into the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment