[Home] / Mac setup / ssh-smtp

How to send mails through your smtp server from outside

If you are at your institution, you probably use an smtp server at your institution to send mails. However, if you are outside your institution, there are cases when you cannot reach the smtp server. For example, :

Even in those cases, if you can log on to your smtp server by using ssh, you can send mails. I learned this trick from Sato-san at Osaka Univ.

  1. On Mail, open Preferences > Accounts.
  2. Create a new "Outgoing Mail Server (SMTP):", named "localhost".
  3. Click "Server Settings..." and set the "Server port" to 10025.
    [SMTP settings]
  4. Select the "localhost" as your SMTP server for your mail account.
  5. On Terminal, type:
    	ssh -L 10025:localhost:25 smtp.foo.edu
    				
    where smtp.foo.edu should be replaced by your smtp server.
  6. Type password and log in.
  7. Now that the SSH port forwarding is established, you can send mails.

Here is an image of how it works.

[image of ssh forwarding]
2005-07-08 Taku Yamanaka