I finally got around to scratching an old itch today. I’ll describe the problem and the solution, on the off chance that someone may find it useful.

My ISP provides an email account I still use, even though web-based mail has various advantages. I just prefer the Mail.app interface over the gmail interface. The account uses pop and smtp, as is typical. At home I this works reliably and well. Here’s the problem: if I leave my house and try to use this account from say, work, I can still download mail, but my ISP’s smtp server will not accept outgoing mail from outside its domain.

Here is how I solved the problem.

Besides my Mac, I have an Ubuntu box at home. One of its main purposes is to run an ssh server exposed to the outside world (port 22 on the Ubuntu box is the only port my router exposes). Among the many useful tricks ssh can perform is to provide a SOCKS proxy. It turns out to be a simple matter to use this proxy to solve my email problem.

To use my email account from the road, I simply bring up a console and enter the command:

ssh -D 2345 drc@myubuntubox

Once that session is established, I fire up a mail client configured to connect to the internet via a SOCKS proxy listening on port 2345 (there is nothing special about the port, it is just easy to remember). I use Thunderbird for this purpose, so not to have to hassle with changing Mail.app’s configuration back and forth.

Works like a champ.