At BoxDev @ BoxWorks 2016, we had the pleasure of sponsoring the Box Hack Day (shout out to LightBox Create for winning the SendGrid prize!) and providing a lightning talk about simplifying email attachments to enthusiastic Box developers. Two common themes we heard from attendees regarding email and files was 1) analytics and 2) storage/file limits. Fortunately, our lightning talk demo addresses both of those issues!
This post expands upon that lightning talk and walks you through how to leverage Box and SendGrid to make sending and receiving emails with attachments a breeze, while adding robust functionality. Specifically, you will learn how to leverage Box’s ability to secure and store large files along with SendGrid’s world class email deliverability and analytics.
The software used to illustrate how you can integrate Box with SendGrid is available as open source on GitHub. It is written in Python and can be hosted wherever you like; however, our example is hosted on Amazon’s Elastic Beanstalk.
The demo software is not designed for production purposes, rather it should serve as a guide on how to get your own implementation executed quickly. Please create an issue on GitHub if you have feedback or require assistance. We are always happy to help.
Sending an Email With Attachments
With the email sending demo, we demonstrate how to obtain a file from a URL, save it to Box and include a link to that file in your outgoing email. Since the file is stored behind a link, you can utilize SendGrid’s tracking capabilities to discover who clicked on the link and when. You can then use Box’s enterprise level security to control access to the file.
Here is an example of the email activity view from your SendGrid dashboard:
In the README section of the source code you will find the installation instructions.
Receiving an Email With Attachments
The email receiving demo, shows an example of setting up a server that utilizes SendGrid’s Inbound Parse webhook to listen for incoming emails. When an incoming email is received, we parse the attachment and store it in Box. Now, you can securely store incoming files and save storage space inside of your email client. In the README section of the source code you will find the installation instructions on how to host the server locally and/or on Amazon’s Elastic Beanstalk.
You can also follow along with me in the demo below:
If you find any issues with the demo or have feedback, please let us know on GitHub by opening an issue. We would also love to learn about your use cases and how we can further enhance them. Let us know at email@example.com.