Is it possible to use Sparrow over a SSH-tunnel since the imap and ssl ports are blocked at my work?
I think your basic strategy is correct, e.g.:
ssh -L 587:smtp.gmail.com:587 -L 993:imap.gmail.com:993 user@yourremotehost
should get you talking to Gmail via yourremote host. Potential problems are if you do not run this as root (with sudo), you are not allowed to specify local ports below 1024 - so you can't use 587 or 993 as your local ports. So, do something like this:
ssh -L 9587:smtp.gmail.com:587 -L 9993:imap.gmail.com:993 user@yourremotehost
...and configure Sparrow to talk to localhost on those high local port numbers instead of the defaults.
Again, you can debug by trying 'telnet localhost 9587' which should get you an SMTP prompt from Gmail. If that works, you should feel confident that the SSH part is working, and concentrate on Sparrow configuration.
If you get it all working, an alternative to the commandline switches is to make a file called 'config' in your local .ssh directory that looks like this:
Host yourremotehost LocalForward 9587 smtp.gmail.com:587 LocalForward 9993 imap.gmail.com:993