Mail tunnelling script

This very simple perl script (ssh wrapper, actually) allows you to connect from outside your department to the mailserver through an ssh tunnel, provided you dept. firewall accepts ssh connections. You may therefore configure your email client to direct outgoing mailserver requests to port “xxx” on “localhost”, once the script has been launched specifying “xxx” as the forwarding port. The net effect is emails will look like as sent from the dept. mailserver, which usually improve their spam score … You can use the script as follows:

mailscript -l 32323 -t host.allowing.ssh.connections -s mailserver.host

where 32323 is the local port used to forward outoging mailserver requests, host.allowing.ssh.connections is the qualified name of an host within our dept. (i.e. after the firewall) accepting incoming ssh connections and eventually mailserver.host is the qualified name of the mailserver within the dept.

You should configure the email client in such a way the localhost 32323 port is used for outgoing mailserver. Below you can find the configurations for the Mac OS X Mail client, as an example.

Download mailscript source code from here.

Configuration window for the tunnel mailserver, reached choosing Account then Outgoing Mailserver  in the Mail preference panel