How To Easily Send Files From Your Mac to Gmail

As you may know, I moved my primary work mail to Gmail using the Google Apps engine. I’ve always been a huge fan of Gmail’s web UI, but when Google announced Priority Inbox and the new accounts for Google Apps users (they’re basically just like personal accounts now, but they run on Apps) I thought it was the right time to switch. I haven’t looked back: Gmail is powerful and the Priority Inbox makes navigating through hundreds of messages a day a better experience.

Gmail comes with free online storage space. You can basically store as many emails as you want and forget about deleting attachments because the email provider requires so. So I thought: wouldn’t be great to be able to store files on Gmail and easily retrieve them from any device? It’s still normal email, with my files in it. Follow the instructions below to see how you can upload files from your Mac’s Finder to Gmail with just one click.

I use Dropbox on a daily basis, but I don’t want to store all my files in it: sure, I got 6 GB for free with the referral system, but I don’t want to waste space with that .mp3 my friend sent me or that .PSD for MacStories mobile I have to check on later. I want to keep Dropbox clean and organized, and dump everything in else in Gmail. Google’s powerful search and filtering system will then allow me to open those files when I need to.

I searched for a way to integrate Gmail with the Finder or the browser (Chrome or Firefox), but all the solutions I found are no longer supported by the developers or simply don’t work with the new Gmail. You also have to consider that Google Apps accounts still differ in some way from regular accounts (APIs, I guess) and I wanted a universal solution that would work across all kinds of accounts. So the native Mac app idea had to be put on the shelf. What’s left? Regular email, a simple “send to” with Mail.app. But instead of giving up and just go back to the old “email yourself” system, I figured that a monitored folder powered by Folder Actions would be the ultimate solution to my needs. Indeed it is.

Folder Actions, a great tool built-in OS X, allows you to run an Applescript every time something changes in a folder. For example, I have a folder action set up to my Desktop/Images folder that resizes a picture to 600px every time a new file is dropped in it. Folder Actions can monitor a folder for changes, and when they see one they try run an associated Applescript. It’s very simple to setup: go look for Folder Actions Setup.app in System/Library/CoreServices (I even put it in my dock so I don’t have to browse to that path every time), fire it up and here’s what you’ll see:

(my 3 scripts as seen in Folder Actions Setup)

Folder on the left, associated script on the right. Scripts must be placed in ~/Library/Scripts/Folder Action Scripts - where “~” is your user directory. Alternatively, you can drop the scripts in /Library/Scripts/Folder Action Scripts, but I wanted to separate my personal ones from OS X default ones.

So, back to Gmail. I wanted a script that would recognize a file dropped in a monitored folder, and send it to my Gmail account with a pre-selected Subject and message. Luckily enough, I stumbled upon this 2007 tutorial from Mac OS X Hints (via Murphy Mac) which basically contains a download [direct link] to an Applescript called “mailer” that does exactly what I needed: it sends a file dropped in a Folder Action-powered folder to a pre-configured address. Once you’ve downloaded the file, open the .dmg and double click on the applecsript file inside it to open it with Applescript Editor. You’ll need to change a few details to make the script work properly.

Change “theSender” to the email address you want to use to send files (and which must be configured in Mail.app), change “recipeAddress” to the account you want to send files to and insert a message in “msgText”. Scroll down, and put the subject you want after subject: - that’s it. Choose File - Save As, change the format to “Script” and save it in one of the locations I mentioned above. Now go create a folder (I created a “Files” one on my desktop) and associate the script to it using Folder Actions Setup. Done.

Now, every time you’ll drop a file into that folder the Folder Action will activate the Applescript and tell Mail.app to send an email to a specific address with that file attached. The downside to this is that you’ll have to clean up that folder every once in a while, as the Applescript doesn’t delete the file once it’s sent. Perhaps one of you guys can edit it - let us know if you do. Also, don’t worry about Mail.app getting in the way: the new message will flash on screen for less than a second and then the app will do everything in the background.

On Gmail, I’ve created a filter that takes the emails coming with the subject I selected in the Applescript, marks them as read, skips the inbox and never marks them as important. They just go into the Archive and receive a “Files” label.

And that’s it. It may not be the most elegant solution ever, but it works. In this way, no matter the device I’m on or the OS I’m using, I can access my files by simply logging in Gmail. Plus, it takes a drag & drop to send a file over. If you have tips and suggestions, drop us a comment below.