OS is Windows (any flavor, I can adapt). I'm having an issue where I need to connect to imap.google.com (and other services) and it only accepts port 995.

If I try to connect normally, it timeouts. If I manually connect through putty issuing CONNECT plus proxy credentials (username & password) the remote host disconnects me (which I think is a good thing, since I'm doing a simple HTTP/1.1 request).

Now, I need to know what kind of software I can use to create a -local- proxy, either using a specific software or SSH tunneling stuff, so my connections to localhost:600, for example, get redirected to imap.google.com:995 BUT authenticating against the proxy I'm behind.

Any ideas?

1 Answer 1


Socat can probably do this. Binaries for windows are available here.

You can then use socat TCP-L:600,reuseaddr,fork,PROXY:yourproxyaddress.example:imap.google.com:995,proxyauth=user:pass,proxyport=8080.

  • Awesome! your socat suggestion helped! the command however is a bit wrong, as it makes socat throw an error about requiring two addresses. A quick google search and experimentation allowed me to generate the correct command: socat TCP-L:600,reuseaddr,fork PROXY:proxy:imap.gmail.com:993,proxyport=8080,proxyauth=usr:pwd thanks! :D - Also, how can I run multiple socats (I need 2, one for IMAP and another one for SMTP) without having those command windows opened? And is there a way to make it go through a local SSH server first (for security and encryption)? or should I make a separate question?
    – DARKGuy
    Mar 31, 2014 at 16:43
  • @DARKGuy I updated my answer to correct the command. You can write the commands in a batch file and use something like bat to exe converter to create exe that doesn't open the command line window. I don't know how to add ssh in there, though if I'm not mistaken port 993 already has ssl encryption. Mar 31, 2014 at 17:17
  • Alright. Don't worry, I managed to make a simple batch script to do so. Thanks a lot! :D
    – DARKGuy
    Apr 7, 2014 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .