Sleep Your Mac by email

MurphyMac posted a cool little trick to configure your Mac to watch for custom email subject lines and then run Automator actions on their receipt. In his example, Murphy shows how to tell his Mac to go to sleep (using Apple's Automator sleeper action) when he sends mail with "sleeper" in the subject. The secret lies in a combination of AppleScripty goodness and Mail rules. He also posts a "how to reboot a PC by eMail" hint for those of you who are, in the words of 30 Rock, wearing bicurious shoes, at least operating system-wise.

![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 1)
Tush said 2:09PM on 1-02-2007
What's Murphy's email address?? I totally want to randomly send him random emails with the subject "sleeper"
Reply
Matthew said 2:19PM on 1-02-2007
Two weeks form now we'll be reading about some spammer in his basement who thought it would be funny to send out trillions of messages with "sleeper" in the subject line hoping to catch a bunch of Mac users off guard.
Maybe it would be smart to use a customized word other than sleeper for this and other reasons. You don't want your Mac going to sleep when Netflix notifies you that they've shipped out your copy of Woody Allen's Sleeper, right?
Reply
Peter said 2:13PM on 1-02-2007
A better trick would be to get it to wake from sleep when it receives an email.... Oh, wait.
Reply
Leonard Nimrod said 2:20PM on 1-02-2007
As I recall, this was posted on MacOSXHints.com early in 2006. I think the poster was looking for torrents while at work, sending the .ottent file to his home account and having automator start the torrrent automatically. Pretty neat.
Reply
Leonard Nimrod said 2:52PM on 1-02-2007
Here it is:
http://www.macosxhints.com/article.php?story=20060612193639842&query=email%2Btorrent%2Bapple%2Bscript
Reply
Marc D. said 2:51PM on 1-02-2007
"Use AppleScript and Mail to auto-start torrent downloads"
http://www.macosxhints.com/article.php?story=20060612193639842
and similarly
"Use AppleScript and Mail for remote control and file access"
http://www.macosxhints.com/article.php?story=20060420065151134
Reply
Allan L. said 3:06PM on 1-02-2007
Why isn't this a huge security flaw?
Reply
Levi said 3:10PM on 1-02-2007
I used a similar thing (only needs AppleScript, not Automator) to get my BitTorrent client to quit at 1600 because I'm on a limited bandwidth deal at peak times.
Now I just use Transmission, which has a built in "speed limit" for certain times of the day, so I just set it to 0kb/s between 1600 and 0000. Much simpler and less likely to fail :)
Reply
Phil said 3:34PM on 1-02-2007
You could definitely set a rule to only allow certain senders (yourself) to activate the sleep function...
Reply
pixelslut said 4:10PM on 1-02-2007
why do all this when you could just use ssh?
Reply
W1m3tųµ said 7:04AM on 1-03-2007
So how do you sleep your Mac using SSH?
Reply
Mike Cosentino said 5:22PM on 1-02-2007
It seems that if Mail.app downloads an email before my BlackBerry, the BlackBerry won't download it. So while I'm out of the house I quit Mail.
Sometimes I forget to quit Mail before I leave so I created a script like this.
I setup a gmail account and made it that if that account receives an email (with a specific subject, etc) then it runs an apple script.
What the script does is disables my primary email account, so my BlackBerry can download them.
By using the seperate gmail account to watch for email, I can send it another email and it enables the disabled account.
It also sends me an email telling me the status of the account :)
Reply
BobbyW said 6:26PM on 1-02-2007
Cosentino -
That's cool.
This tip is also good for machines with dynamic ip addresses. You can make them do something easily by email.
People say it's not secure. Why not? It's just an email. Any email can be sniffed. People don't know this email is a trigger. It's no less secure than any other email you send.
Reply