Use ProxyCap. Add there a "redirect" rule for the Mail.app bundle.

Note that a regular HTTP proxy will not work for Mail.app. You will need one of the following: SOCKS, SSH.


If you have ssh access to the machine you want to be a proxy, you can also do ssh -D 12345 proxy.server.com and configure your computer to use SOCKS proxy, using localhost and 12345 as proxy host and ports in the settings, accordingly. Obviously you can specify a different port, but it's best to keep it higher than 1024.

The -D option for ssh enables a built in SOCKS proxy, which you can use then to send all other traffic through. Please bear in mind that the traffic from terminal (telnet, ssh) will NOT go through the SOCKS proxy regardless of how you configure your network settings.

I would have uploaded relevant screenshots, but unfortunately the internet connection I use here is very slow - 256kbps satellite link, shared by around 50 people and a host of experiments!