Secure Tunnel for Email

Having recently moved to a new web/email hosting company, I’ve been excited to be using IMAP rather than POP3 for accessing my email. (For a good summary of the benefits of IMAP, see the IMAP Connection.)

I wanted to make a more secure connection to my mail server to encrypt my password and email messages. Some servers provide an SSL-enabled IMAP server, but mine does not. Instead, I set up an SSH tunnel using PuTTY.

With PuTTY, the basic idea is to establish an SSH session/connection from your local system to the server. Then, set up an SSH tunnel that will forward a local port to one on the remote server. In this case, I set up local port 3333 to connect to remote port 143 (IMAP). Then, I set up my email client (Outlook Express) to connect to the IMAP ‘server’ located at 127.0.0.1, port 3333. All communcation to the IMAP server will be sent (encrypted) through the SSH tunnel.

Once it’s set up, I just need to connect to my server with PuTTY, then fire up my email client. They also provide a command-line tool Plink which could be used to make the connection.

I should probable also set up my SMTP for forwarding in a similar fashion, just to cover the outgoing messages as well.