Cloudinary Blog

Securely Uploading Images to Cloudinary by Email

Securely Uploading Images to Cloudinary by Email

Despite United States founder Benjamin Franklin’s wisdom that three can keep a secret if two of them are dead, you as developers often need contributions from third parties for your project. However, in today’s digital world, security in software development is a predominant concern. With respect to management of rich media, it’d be ideal if those folks could upload images or videos to your Cloudinary account without having to log in.

This post explains how to enable third parties, including project contributors and end-users, to do that by email with free, integrated tools, including SendGrid, Cloudinary’s email server. Actually, that basic function already exists in many electronic devices, from smartphones to smart fridges. Setting it up is a snap.

The Process Flow

First, you need an email server but with a twist. As mentioned, we at Cloudinary leverage the one from SendGrid, which accepts any email it receives and then parses it.

Here’s the process flow:

  1. A third party sends an email with an image attachment to the address you configured with your email provider.
  2. For each email, SendGrid creates a webhook and sends it to a Cloudinary app that’s deployed on Heroku.
  3. The app parses the webhook and uploads the image to Cloudinary as an unsigned upload.

The Prerequisites

Following are the requirements, starting with the final destination, Cloudinary:

Note: Some of the steps generate parameters for the next step. We’ll work on eliminating that complexity.

  • A Cloudinary account. A free one will do just fine. Log in to the dashboard and copy your Cloudinary URL from there for the next step.
  • A platform on which to host your code. Even though you will execute Python code on Heroku, any platform will do. The code repository is on GitHub. You deploy the code with just a button click with no manual efforts whatsoever.
  • An email-service provider. Cloudinary has picked Twilio’s SendGrid as the service provider for receiving and sending emails for uploads to Cloudinary’s Media Library, as described in this post. A free account will do just fine
  • A registered domain. You’ll need to create mail exchange (MX) records to point to the email-service provider.

The Procedure

Refer to the readme on GitHub, which explains how the Cloudinary app cloudinary-email-uploader works with SendGrid's incoming parser to empower third parties to send email along with images to your Cloudinary account. In addition, you’ll learn how to—

  • Acquire the prerequisite free software.

  • Configure and deploy cloudinary-email-uploader.

The complete code is also on GitHub.

Do give it a try and comment your results below.

Recent Blog Posts

JavaScript File Upload

Uploading software files to the web, mobile, or desktop is as old as the web itself. Billions of files are moved around and downloaded on the Internet daily. Coincidentally, as the de facto language in which many apps are written, JavaScript is also as old as the web.

Read more
What’s New for Video in E-Commerce

With videos becoming more and more paramount for promoting online sales, we at Cloudinary Labs are building technology to help grow the business of e-commerce retailers. This series of blog posts delves into a few use cases that promise to boost retail revenue online across the patron’s browsing journey through the e-commerce site.

Read more
ImageCon 2020: A Digital Experience

Despite our disappointment at the cancellation of our fourth annual ImageCon conference in late April due to the pandemic, we forged on and are thrilled to announce a digital version of ImageCon on Monday July 27 through the 30th, an excellent forum for learning from our customers, partners, and colleagues. The new digital format will deliver much of the same Visual Web-related content planned for April along with new additions, featuring five interactive sessions by renowned experts in the media sector. Each session will be about 30 minutes long, during which you can ask the speakers questions live and “get on stage.” Also, you can watch the sessions on demand afterwards.

Read more
Good Reads Meet Visual Tools at Bloomsbury

Most might know Bloomsbury Publishing as the publisher of the Harry Potter series. What you might not know is that the publishing house also has a vibrant academic division that offers digital reproductions of encyclopedias, manuscripts and museum collections for use by university libraries and researchers. Seeking a way to manipulate and serve high-resolution images, combined with security that prevented anyone other than library patrons and paid users to access the content, Bloomsbury discovered Cloudinary’s digital asset management (DAM) solution.

Read more