For Mac:
Have you ever been away from your Mac and wanted to shut down, restart, or needed to open an application remotely, but didn’t have access to anything except your iPhone? Well, I am going to show you how to do these tasks with AppleScript and Mail.
This process is fairly easy and involves creating a simple AppleScript and some Mail rules. Note that since these rules will cause your Mac to perform the listed action when they run, be careful when testing!
Continue reading to learn how to build this AppleScript.
Creating the AppleScripts
For this how-to, I am going to show you how to shutdown, restart, and sleep your Mac. Just copy the following scripts into the Script Editor.app (~/Applications/AppleScript/Script Editor.app). These scripts are the Finder scripts that I showed you earlier.
Shutdown
tell application “Finder”
shut down
end tell
Restart
tell application “Finder” to restart
Sleep
tell application “Finder”
sleep
end tell
Saving your AppleScript
Click File > Save and choose “Script” from the “File Format:” drop-down box. Remember where you save the .scpt file.

Setting the Mail rules
This part is fairly simple and settings may vary by user preference. Open Mail.app and navigate your way to Preferences > Rules and click “Add Rule,” then follow these instructions for each command you want to use:
- Add a description (this is for your information)
- Select “All” from the “if” drop-down box
- Under “If all of the following conditions are met:”, add these things: (you will need to click the “+” to add the second item)
- “Subject” … “Contains” … “System”
- “Message Content” … “Contains” … “shutdown”
- Under the “Perform following actions:”, add these things: (you will need to click the “+” to add the second item)
- “Set Color” … “of text” … “Red”
- “Run AppleScript” …
- Beside the “Run AppleScript” action, you will see a choose box, click it and navigate to where your saved script is located. Click on the script and then on “Choose File”
You should end up with something like this:

Running the script remotely
To run the script, all you have to do is send an e-mail to your account with the subject and message contents as you specified them in creating the rules. For the rule that I created, I would send a message with “System” as the subject and “shutdown” as the contents of the message.
Additional Notes
- You can include unusual characters for message content conditions (i.e. #, @, or ^) in order to avoid accidentally running a script that you didn’t want (for example use: #shutdown# instead of just shutdown)
- If you have multiple rules in Mail.app, you might want to consider using “Stop Evaluating Mail Rules” as an additional action
- It is also a good idea to have Mail.app check for new messages often for this to work well
For Windows:
This is a (proof-of-concept) outlook macro that you can use with an outlook rule to retrieve your files from your home/office PC by sending it a mail with a subject having a predefined special keyword and the body containing the names and paths of the files. The remote PC will then mail you the files on a predefined e-mail ID.
This project came into being after reading this post at lifehacker (original post and solution here). It listed a method to retrieve mails on your home/office PC by sending a “magic email” to it, but it was only for mac’s. Seeing that people wanted it for windows as well, I thought of making something up during lunch time at office.
Usage:
1. Download the attached zip file (shantz-outlook-remote-file-access.zip) and unzip it. It has a VB module “shantz-outlook-remote-file-access.bas” (can be opened with any text editor)
2. Create a new macro in Outlook. Copy the code contained in Module1.bas to the main source file of the macro.
3. Edit the code to change the e-mail ID to which the files will be e-mailed. Save the macro.
4. Create a new rule in Outlook. Choose to run the rule when a specific word is found in the subject. e.g. use “SendMeMyFiles”.
5. The action part of the rule should be “run a script”. Here you can choose the macro that you just created from the list shown by Outlook.
6. Save the rule and you are done.
Now try, sending a mail to the account that your outlook is configured to receive mail for, with the special keyword in the subject and a list of files (with their complete absolute paths on the remote computer) separated by semicolons (”;” without the quotes), and watch magic happen :).
e.g.: To: myemail@email.com
subject: SendMeMyFiles
Body: c:\path\of\files\file1;d:\second\path\file2
IMPORTANT NOTES:
- For this thing to work, outlook has to be running on the remote PC as this depends on a “client-side” rule.
- This is just a proof-of-concept as of now, so there is no error handling right now. Plus the e-mail body parsing is finicky and so the e-mail body should not have anything other than the file paths and names. This might change in future if I decide to update it.
- Don’t use it if your life depends on it. Use it for basic purposes and modify and improve it appropriately before you decide to use it seriously (You may submit your modifications here as well)
- It has been tested only on Outlook 2003, but might work on others as well.
Download: shantz-outlook-remote-file