Kenneth Friedman
January 3, 2018

This post introduces the idea of batching email to be less distracted and more productive. Then, it describes in-detail how to setup your Gmail for batch email. No programming experience or 3rd party services required. Completely free.

Why You Should Batch Your Email

Email is great. It's not controlled by one company. You can switch providers, and communicate with any other provider. You can even host your own email server. It's been in constant use since the 1960s and it's literally never gone down.

But sometimes, email can be a distraction to getting work done. The constant trickle of mail throughout the day can burn hours of time, and prevent you from solid chunks of focused work.

Many people — and studies — have suggested that limiting email use to only a few times a day will decrease stress and make you more productive. But old habits die hard.

Luckily, we can take control of our own technology and use it to our long-term advantage. To help only check email a few times a day, we can use the idea of batching our emails.

By batching emails, new messages won't trickle in exactly when they are sent: they will all appear in your Inbox at the same time. You can do this by setting up your email service to only deliver email a few times a day. That way, if you check your email frequently, there won't be any new messages to see.

Gmail is one of the most popular email services, and the one I personally use. There are services for $5/month to batch your GMail. However, in about 20 minutes, you can very easily set up your own batch email system. Here's how to do it.

How to Batch Gmail

By following these steps, you can set up your Gmail to only show new emails every 4 hours. (Or 2 hours, or 1 hour). It takes less than 20 minutes, and does not require any programming experience (though you will have to copy-paste a chunk of code).

There are two simple steps to this process:

  1. When a new email comes in, hide it from the Inbox (by marking the email as read, archiving it from the Inbox, and applying a special label to the email)
  2. Every 4 hours, take each email that has arrived within the last 4 hours, and display it in the Inbox (by selecting all messages with the special label, moving them to the Inbox, marking them as Unread, and then removing the special label).

Here are the details to implementing these two steps.

1. "Hiding" Incoming Mail from the Inbox

To hide the incoming mail from the Inbox, we will use Gmail filters to immediately mark an incoming message as read, archive it from the Inbox, and apply a special label to the email (so that we can know to move it back to the Inbox later). Here are those steps:

First: Download this filter file: Batch Mail Filter. This filter takes every incoming email, removes the email from your Inbox, and applies the label "toBatch".

Second: go to GMail's filter settings by clicking this link: https://mail.google.com/mail/u/0/#settings/filters (or, by going to Gmail ➡ Settings ➡ "Filters and Blocked Addresses").

Third: In GMail's filter settings, click "Import Filters"

Fourth: Click "Choose File", and select the downloaded file from the first step.

Fifth: Click "Open File"

Sixth: Click "Create Filters".

Seventh: You should see a filter created sign.

Optional Step: If there are messages from any people or messages with keywords that are worth being interrupted for, you can edit the filter to exclude certain messages from being hidden from the Inbox.

With these 7 steps complete, incoming email will now be labeled "toBatch" and will not appear in the Inbox. In the second part, below, we will set up a system to move all of these messages back to the Inbox every 4 hours.

2. Moving the Hidden Mail back to the Inbox Every 4 Hours

First: Go to Google Sheets, here:https://sheets.google.com.

Second: Start a new, blank spreadsheet. give it any name. For example, "Send to Inbox". The name will not be revelant to the rest of the steps.

Third: Go to the Scripts Editor by clicking the "Tools" dropdown menu, and selecting "Scripts Editor"

Fourth: In the large text field, replace the starter-code with the following snippet. If you haven't programmed before, fear not: just copy and paste the code below into the text field.

function sendToInbox() {
var threads = GmailApp.search('label:toBatch');
var toBatchLabel = GmailApp.getUserLabelByName("toBatch");
GmailApp.markThreadsUnread(threads);
for (var t in threads) {
threads[t].moveToInbox();
threads[t].removeLabel(toBatchLabel);
}
}

Fifth: Name the script by clicking "Untitled Project" and giving it a name. Feel free to give it any name you would like. "Batch Gmail" is a fine name.

Sixth: Now we need to set this script to run every 4 hours. Start by clicking on the Trigger Icon, which looks like a clock.

Seventh: Click to add a new trigger set up.

Eighth: The default trigger that was created is almost perfect. Just change the "every hour" time to "every 4 hours." If you want a different interval, now is the time to select your interval. However, 4 hours is recommended.

Ninth: Click save. You'll now need to authorize the script to modify your email data. Click "Review Permissions."

Tenth: You'll next see a warning that "This app isn't verified." This is tricky, click the small "Advanced" button on the bottom left.

Eleventh: In the advanced section, click the once-again small button: "Go to X", where X is the name you gave to the script. It will safe "Unsafe" as well, but there's no reason for concern: you are approving code that you put there, and that you (and only you) have control over.

Twelfth: To finally authorize the script, you need to "Allow" your script to access your email. And once again, you have full control over the you're approving.

Thirteenth: Lastly, save the trigger. Now this script will run every 4 hours.

Now, every 4 hours the script will run. It will take all messages with the label "toBatch," and it will move them to the Inbox. It will also remove the label from those messages.

If you've had any trouble getting this to work, let me know. I'd be happy to help you out.

Now that you've batched your email, you will be distracted fewer times throughout the day, and you'll have more time for focused, deep work.

Special thanks to Ian Reynolds for testing out this guide.