How To Automatically Back Up And Purge Your Gmail Every 30 Days

How To Automatically Back Up And Purge Your Gmail Every 30 Days

If the Sony hack has taught us anything, it’s that keeping incriminating emails in your inbox is a terrible idea. If someone gets into your email, everything you’ve ever said could be out in the open. Here’s how to make sure that doesn’t happen by automatically backing up and deleting everything in your Gmail account on a schedule.

How to Automatically Clear Out 30-Day-Old Messages

How To Automatically Back Up And Purge Your Gmail Every 30 Days

If you want to clear out your Gmail every so often, you’ll need a Google Script. We’re going to use this one from Digital Inspiration. You can do this with a lot of email clients, but we’re going to focus on Gmail. If you’d prefer, here are guides for Outlook and Thunderbird. Google Apps owners can also just change the retention period for emails. That said, here’s how to set it up on regular old freebie Gmail account:

  1. Click here to make a copy of the Google Auto-Purge Script
  2. The script deletes emails based on label, so you’ll need to enter the labels you want here. For a catch-all, use “Inbox”, for the var GMAIL_LABEL = " "; line. Unfortunately, you’ll need to do this for each label, but it will also pull messages you’ve archived.
  3. Enter in the number of days you want to schedule the purging for under var PURGE_AFTER = "1"; for our purposes we chose 30. Any message older than 30 days old gets sent to the trash
  4. Click Run > Initialize and follow the prompts to add permissions
  5. Click Run > Install to install the script.

Now, your Gmail account will clear out any message older than 30 days. If your Gmail account is filled to the brim with email, you might want to go through and delete everything manually at first. It’s worth noting that this moves your messages to Gmail’s trash, which takes 30 more days to completely delete. If you’re worried about that, set a reminder to pop into your trash and manually delete everything.

How to Back Up and Encrypt Your Gmail Account on a Schedule

How To Automatically Back Up And Purge Your Gmail Every 30 Days

Deleting your email is pretty easy, but you can’t search through old emails once it’s gone. That sucks. So, you might consider making an encrypted, local backup of your email. This way, you can search through it when you need to, but your emails won’t be stored on anyone’s servers, ripe for hackers.

You have a lot of options for this (including some if you’re not using Gmail), but we’re going to use the open source software GMVault to download a backup of the Gmail account.

  1. Download and install GMVault for your operating system
  2. Open the app, you’ll get a command line interface
  3. Head back to GMVault and type in gmvault sync -e [email protected] replacing [email protected] with your email address
  4. You’ll be asked to log in and allow GMVault access to your account in your default browser. Click “Allow Access”
  5. Head back to GMVault and press Enter. It will back up all of your email and encrypt it (your encryption key is saved on your hard drive under /users/name/gmvault-db/.info/.storage_key.sec). It takes a while, so let it do its thing.

That’s your first backup and it will probably take a while before it’s finished up. Restoring your email depends on how you want to view them. GMVault has a guide for various restore options depending on when you want. Once the GMVault backup is done, you’ll want to set up a system to back up your email once a week. How you do this depends on whether you’re on Windows or OS X.

If you’re not using Gmail, you can create a backup of your email using just about any desktop email client. Here are guides for some of the more popular apps:

When you finish backing up your email, you can then go ahead and encrypt those files locally if you want.

How to Automate the Backups on Windows

How To Automatically Back Up And Purge Your Gmail Every 30 Days

GMVault features a sync feature that looks at your current backup and only backs up new messages. It can only look back one week though, so you’ll want to run your backups once a week. On Windows, you can do this with Task Scheduler:

  1. Open up Task Scheduler (Control Panel > System and Security > Administrative Tools) in Windows
  2. Click Create Basic Task
  3. Name the task and set the trigger to Weekly (you can do this daily if you want to be extra safe)
  4. Click the Action tab and select Start a Program, then select the gmvault.bat file, by default it should be here: C:UsersNAMEAppDataLocalgmvaultgmvault.bat
  5. Select Add Arguments and add this in, substituting your email for [email protected] sync -e -t quick [email protected]

That’s it. You can right-click it in Task Scheduler and select Run to test it out.

How to Automate the Backups on Mac

How To Automatically Back Up And Purge Your Gmail Every 30 Days

In OS X, use Automator to run GMVault on a schedule:

  1. Open Automator (Applications > Utilities) and create a new document
  2. Select “Calendar Alarm”
  3. Add the Run Shell Script action
  4. In the text box, type in gmvault sync -e -t quick [email protected] replacing [email protected] with your information. Depending on where Gmvault is installed, you might need to include the directory there as well
  5. Save the file
  6. When it’s saved, it will automatically open up Calendar with a new event. Set the calendar event to repeat once a week

Automator will run GMvault once a week to back up your email.

That’s it! You’re now backing up and deleting your email on a set schedule so you don’t have to worry too much about hacks.


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


3 responses to “How To Automatically Back Up And Purge Your Gmail Every 30 Days”