Skip navigation

Tag Archives: hacks

At my office, the ISP blocks all SMTP servers except for theirs… problem is, for some reason my account can’t send email! So I have to end up using webmail (ick), or hack my way around it. It’s very handy to have an SSH server or two lying around. If you do, you can just create an SSH tunnel to your SMTP server, and send your email through that!

I wrote a quick little script to run when you find yourself in this situation: just make sure to run it with admin privileges. Your email client won’t even know the difference!

sudo ./smtp_tunnel.sh

smtp_tunnel.sh:


#!/bin/tcsh

cp /etc/hosts /etc/hostsBackupSMTP
echo "127.0.0.1 [your.smtp.server.com]" >> /etc/hosts
ssh [username]@[your.ssh.server.com] -L 25:[your.smtp.server.com]:25

#restore once the tunnel is broken
cp /etc/hostsBackupSMTP /etc/hosts