I have just moved and changed my ISP to one that not only blocks port 25 but also only allows their SMTP relay server to be accessed from within their own network.

When I’m at home with my laptop I have set my outgoing SMTP server as smtp.myhome-isp.com and all is fine. But when I want to work out of my office I have to change it (for all my seven accounts) to smtp.myoffice-isp.com.

I looked and asked around for some smart solution to this problem but found none except the advice to setup my own mailserver or subscribe to a mailserver service.

So, I did the same thing that I did years back when I had the same ISP (and the same problem) – I created two hosts files where I put the IP adresses to respective ISP’s SMTP relay servers. (The hosts file is where your computer goes before it goes out to the DNS to lookup an ip adress.)

  1. Goto c:\windows\system32\drivers\etc and make two copies of the hosts file and call them for example hosts.myhome-isp and hosts.myoffice-isp
  2. Edit the files and add an entry to each file for your home and office isp’s SMTP relay servers and add the hostname as mailout. You have to enter the IP address of the SMTP relay server (eg 10.10.10.1 not smtp.myhome-isp.com) if you don’t know it do a ping or nslookup to find out.
  3. On the desktop (or a location of your choice) create two new batch files, eg. MyHome ISP SMTP.cmd and MyOffice ISP.cmd and add these three lines of code to each:

    cd c:\windows\system32\drivers\etc\
    copy hosts.myhome-isp hosts
    pause

    (Line two above should read “copy hosts.myoffice-isp hosts” for MyOffice ISP.cmd)

  4. In Outlook set outgoing SMTP server to mailout

Whenever you move from home to the office run MyOffice ISP.cmd and vice versa. It may not be the ultimate solution but it works (at least for Outlook 2003 and 2007)