Due to recent issues with virii and the like, the IT staff at work has disallowed external pop and smtp. Well, that just sucks for me who has all personal e-mail sent off-site for a reason. So, I figured subversion was necessary. SSH forwarding is a beautiful thing. If you have a server you can ssh to and see the pop or smtp server you are looking for, you can run this script to port forward your connections locally to the desired servers after adjusting the variables at the top. Then, all you need to do is add an entry for your mail server in /etc/hosts that points to 127.0.0.1. Done!
#!/bin/sh # Set up Variables # Mail Server MAILSERVER=mail.domain.com # SSH Server / User SSHSERVER=shell.domain.com SSHUSER=myuser # IMAP Port # 143 - Standard IMAP | 993 - SSL IMAP IMAPPORT=993 # POP Port # 110 - Standard Pop | 995 - SSL POP POPPORT=110 # SMTP Port # 25 - Standard SMTP | 465 - SSL SMTP SMTPPORT=25 # SSH Commands ssh -fL ${SMTPPORT}:${MAILSERVER}:${SMTPPORT} ${SSHUSER}@${SSHSERVER} tail -f /dev/null ssh -fL ${IMAPPORT}:${MAILSERVER}:${IMAPPORT} ${SSHUSER}@${SSHSERVER} tail -f /dev/null ssh -fL ${POPPORT}:${MAILSERVER}:${POPPORT} ${SSHUSER}@${SSHSERVER} tail -f /dev/null