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
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:
- Click here to make a copy of the Google Auto-Purge Script
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.
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
- Click Run > Initialize and follow the prompts to add permissions
- 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
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.
- Download and install GMVault for your operating system
- Open the app, you'll get a command line interface
Head back to GMVault and type in
gmvault sync -e [email protected]replacing [email protected] with your email address
- You'll be asked to log in and allow GMVault access to your account in your default browser. Click "Allow Access"
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
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:
- Open up Task Scheduler (Control Panel > System and Security > Administrative Tools) in Windows
- Click Create Basic Task
- Name the task and set the trigger to Weekly (you can do this daily if you want to be extra safe)
Click the Action tab and select Start a Program, then select the gmvault.bat file, by default it should be here:
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
In OS X, use Automator to run GMVault on a schedule:
- Open Automator (Applications > Utilities) and create a new document
- Select "Calendar Alarm"
- Add the Run Shell Script action
In the text box, type in
gmvault sync -e -t quick [email protected]replacing [email protected]com with your information. Depending on where Gmvault is installed, you might need to include the directory there as well
- Save the file
- 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.