Put Mac To Sleep With an Email and Disable Mail Previews

Mail Tricks

There is no denying that on OS X,


is easily one of the most useful apps for downloading, reading and working with your email on a day-to-day basis. However, as useful as you might consider the native mail application, there is actually a lot more that you can do with it by only knowing a couple of tricks, which is exactly what we’ll show you in this post.

Ready? Let’s get going.

Put Your Mac to Sleep With An Email

This is a really cool tip that requires a bit of advanced tinkering and creating your own Apple script (but don’t worry, we’ll explain everything here), but once you set it up, you can have your Mac go to sleep by just sending yourself an email from one of your accounts.

This can be very handy for those of us who tend to forget about things, including putting our Macs to sleep when we leave the office for example.

Here’s how to set up this neat trick.

Step 1: Open the AppleScript Editor utility (located in the Utilities folder) and then copy and paste this into the editor:

tell application "System Events" to sleep

Once you do, press the Compile button until everything looks like the screen below.

Apple Script Editor

Finally, give your script a name and save it with the ‘Script’ format.

Save Script
Script Saved

You will have to save the script in the folder shown in the pic below (~Library/Application Scripts/com.apple.mail) for it to work.

Saved Script Location

Step 2: Open Mail’s Preferences panel and click on the Rules tab. There, click on the Add Rule button and set these parameters:

Add Rule


Perform the following actions:

– Run Apple Script: Choose the script you just created

Once done, press OK.

Rules Set

With this, every time you send an email to yourself (from your specified email account) that has the word ‘Sleep’ as the subject, Mail will trigger the script you created and put your Mac to sleep.

Mail Sent

If you have an iPhone, send yourself an email from there and you will see your Mac go to sleep right away. Pretty neat if you ask me.

Disable Attachment Visual Previews

One of the best aspects of the native OS X Mail app for me is that if someone sends you an attachment in an email, Mail allows you to view it right within the message by displaying a visual preview of it. So be it a PDF file, an Office document or just a photo, you don’t even need to click on the file to see it.

On some occasions however, it is preferable for Mail to not show previews of attached files. For example, let’s say you are checking your email at a public place and you don’t want anyone else to see your files.

With the help of the Terminal utility though, you can disable visual previews on Mail in just a few seconds.

To do it, just open Terminal and enter this command:

defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes

Then restart Mail and instead of the visual previews of attachments, Mail will only display their icons.

Mail With Preview
Mail Without Preview

If you want to go back to viewing attachments on Mail, just use the same command shown above, but at the end replace ‘yes’ for ‘no’. That’s it.

Hope you like these tips. Both are extremely useful and the first one in particular is really cool. Enjoy!

Last updated on 03 February, 2022

The above article may contain affiliate links which help support Guiding Tech. However, it does not affect our editorial integrity. The content remains unbiased and authentic.