0

I have a very basic piece of Python code:

    import smtplib
    server = smtplib.SMTP(host, port)
    problems = server.sendmail(from_addr, to_addr,  message)

Is there solution to run it behind an HTTP proxy? I am using Python 3.4.1 on Linux with the http_proxy variable set.

Now I am getting a timeout from SMTP, but if I run this code from a proxy-free network, it works OK.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
jesse
  • 13
  • 1
  • 6

1 Answers1

1

Is there solution to run it behind an HTTP proxy?

No, HTTP is a different protocol than SMTP and the proxy is for HTTP only. If you are very lucky you might be able to create a tunnel using the CONNECT command to the outside SMTP server, but usually the ports used for CONNECT are restricted so that you will not be able to create a tunnel to an outside host port 25 (i.e. SMTP).

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172