Photo credit: Windell H. Oskay,
on creative engineering and new media art

How to tunnel your SMTP outgoing mail over SSH

December 14th, 2007

The problem

You’re this guy, or gal, somewhere where you have a crippled internet access. Probably for security reasons, somebody closed most of the outgoing ports in a firewall. You can surf, and use SSH.

The solution

Here’s what you need to know:

  • The name of the SMTP server you normally use. It might be something like
  • The port to use for SMTP on that server. By default it is port 25.
  • The name of a server that will let you log in via SSH.
  • The login and password to use for that server.

1. Download PuTTY. Just search for it, you will find loads of mirrors. Just save the putty.exe executable (it’s not an installer) somewhere.

2. Run putty.exe.

3. Start a new session by entering the host name or ip address, select SSH (port 22). Under Connection > SSH > Tunnels, add a new port. Enter the local port (e.g. “25″) and the destination (e.g. “″) and click “Add”. Note that the local and remote port numbers need not be the same.

4. If you like, save this session so you don’t have to enter the details again. Next time, just open the saved session.

5. Click “Open” in Putty to open the connection. A DOS window will open where you can enter your login and password.

6. Now set up your mail program to use “localhost” as the outgoing smtp server rather than your real smtp server. In Mozilla Thunderbird you do this under Tools > Account Settings > Outgoing SMTP server. Enter “localhost” as the server and the local port number you entered in Putty.