Control A Mac By Sending Commands Via Email

By . Filed in Mac Tips

[Mac only] Here’s something really cool trick I learn from TUAW today, you can actually control your Mac via email. That’s right, by sending an email to your Mac (with certain Subject and Content) you can basically make it perform almost any action you want – like restart, shutdown, sleep, or opening/closing any applications. This trick make use of Mail App’s Rules and Applescripts.

Here’s how you do it. Open up Script Editor.app, put in this piece of command:

  • tell application "Finder" to restart

Save it with a self-explanatory name in folders any folder.

Next, open up Mail app, go to Mail -> Preferences. Inside Rules tab, create a new rule and insert the fields exactly like how I’ve highlighted them.

mac rules

In short, this is what you’ve done. You created an Applescript capable to restart your Mac. Then you added a rule in your Mail app to obey the following instruction:

  • When Mail app received an email with the Subject "system" and Message Content "restart", run the Restart Applescript script.

Now try sending an email to yourself and viola, your Mac will restarts itself!

More things you can control with Email

TUAW gives few more examples, besides restarting it you can create Applescripts to shutdown your Mac or put it on sleep mode. If you are familiar with Mac Applescript, for sure you can think of something more useful.

Security: A little advice

If you are planning to take this up and create lots of commands to control your mac, make sure your commands are not revealed to anyone else, or you’ll end up getting controlled. You can add an extra condition on top to make sure Mail app only obey instruction given by specific recipient.

Or the least you can do, is to make your command (message content) slight complex to guess, with a password perhaps.

Author:

This post is published by a Hongkiat.com staff (editors, interns, sometimes Hongkiat Lim himself) or a guest contributor.

Advertisement