Scenario: Mail account is only accessible behind a VPN connection, how to keep on using Apple Mail Client for your email accounts.


  • Keyboard Meastro
  • Shimo VPN client
  • Some Unix knowledge


  1. First we need to make sure that the settings for the VPN client, has set the routing of the internal network(s) to be used via the VPN.
  2. Add the needed DNS entries to your /etc/hosts file. For obvious reason do I not enter these here. Sufficient to say:
    1. Figure out what the internal servers are,
    2. Or they are provided by your local IT admin.
  3. Prepare your “Keyboard Maestro” actions.

In Keyboard Maestro you have the option to use variables. You can also create an variable in the Apple Script you have as part of the complete script.  

Then this variable is accessible by the Apple Script as well as the KM script.

Below the Apple Script step to access the VPN of my choosing

Thanks to the value we set in the variable we now have in effect created an BOOL. Next step is an If-Then action I have added to make use of the BOOL I just created.

Now the BOOL is used and with a press of a key I can start the VPN, and make sure that my Mail Clients, has the needed account online or offline based on the connected state.