It can be quite beneficial to move select Gmail email attachments directly to a cloud storage provider such as Google Drive, Dropbox or Microsoft's OneDrive.
The reason is simple: usually, you get much better file handling capabilities there, and options to share the files with other users are also integrated into most file hosting solutions. Also, you may make some of these files available publicly on these file hosting services, something that cannot be done directly on Gmail.
If you are a teacher, you could ask your students to send emails to your Gmail account with their homework attached to them, and have the files moved automatically to your file hosting solution of choice.
You could also use that for work. Automatically add all attachments to a folder on the file hosting site that is shared with all team members, so that everyone has access to those files even if they do not have access to the email account itself.
It takes two steps to create such a solution:
- You need to create a filter on Gmail that specifies which attachments gets transferred automatically.
- You need an IFTTT account and create a recipe there.
Create the filter on Gmail
We start with the filter, as we need it to create a new recipe on IFTTT. Here is what you need to do:
- Visit the Gmail website and sign in to your account if you have not done so already.
- Click on the options button on the top right and select settings from it.
- Select filters from the tabs displayed at the top, or open this link directly instead.
- Click on "Create a new filter".
- You need to specify when the rule will be triggered. Since we want to transfer attachments, we have to select "Has attachment" here. If you would leave it at that, all attachments would be transferred to the file hosting provider.
- You can limit this in several ways. Select a To address, a subject, or "has the words" to limit it. You could create a filter that would only add the label if the subject contains the word "work", or only emails that are sent to a specific address.
- Click on "Create filter with this search" which takes you to the final page. Here you select what you want to happen to matching emails.
- Select "Apply the label", and then Choose label > New label from the menu next to it.
- Type a label name, e.g. work and click create.
- You are redirected to the filters tab again. Here you see the label listed. Copy it or remember it, as we need it on IFTTT.
I have mentioned IFTTT (If This Then That) before here on Ghacks.It allows you to create automated rules that it processes for you, something along the like IF the sun shines tomorrow Then send me an email.
Rules use a trigger channel that defines the "This" component of the rule. A trigger channel is a service like Gmail, Dropbox, Google Drive or a device or feature such as Android Device, Android SMS or iOS Photos.
Once you have selected a channel, Gmail for example, you are asked to select the trigger. For Gmail, this can be a new email, a new attachment, new email from an address you specify, a new starred email, a new labeled email, or new email from search.
Once you have made the selection, you are asked to enter additional information if required. None is required if you select "a new email" for example, but if you select "a new labeled email", you are asked to enter that label there.
The "That" part defines the action which is what you want to be run when the "This" part is triggered. Here you select a device or service again, say Dropbox, and select one of the available actions that you want performed.
Create the recipe
To create the recipe on IFTTT, do the following:
- Click on the create button at the top.
- Here you click on this which is underlined.
- Select Gmail from the list of trigger channels.
- Select "new email labeled" as the trigger.
- Enter the label name on the trigger fields page and click create trigger.
- Select that on the next page.
- Pick an online storage provider. IFTTT supports Google Drive, Dropbox, Box and OneDrive.
- Select the action "Add file from url".
- IFTTT fills out the information automatically. You can change the folder path where those files are transferred to however.
- Click create recipe on the overview page to complete the process. Here you find the rule in written form which can be useful to spot errors before you create it.
The new rule is live the moment it is created. I suggest you send a test message to the email address in question to make sure everything is set up correctly. If it is not, go back and modify the recipe or the filter on Gmail to correct the issue.
Note that you need to authorize IFTTT to access Gmail and the cloud storage provider that you have selected.
What you may need to do in addition is notify other users about this, and maybe share the folder on the file hosting service with others as well if that is desired.