You've got mail! Using SendGrid with Stackato
by Diane Mueller

Diane Mueller, July 26, 2012

Stackato and SendGrid With Stackato, developers can easily code, test, and launch an application to any cloud. Some of those applications may need to send email, and we've been advising our users to connect their applications to their own SMTP gateway servers to do this.

But there's a cloudier, "as-a-Service" way to do this.

Now, as a Stackato user, you can send your email from the cloud by using SendGrid. The following is a guest post from Carly Brantz of SendGrid, who can demonstrate how to do this.

The Email Deliverability Problem

SendGrid is a cloud-based service that replaces your company’s email infrastructure and provides everything you need to operate a reliable and scalable outbound email delivery system.

Sign up today using the coupon code "STACKATO3" and receive 3 months of the SendGrid Bronze plan including 40,000 emails/month. You can see how easy the process is with the sample app below.

Email delivery is something many developers take for granted, you can’t assume that your email is being delivered. In fact, more than 20% of the time it isn’t. To help developers better understand email deliverability and the factors that determine whether your email makes in or not, SendGrid has created a comprehensive Deliverability Guide [pdf] which explains the problem in detail.

Sending Email from Stackato via SendGrid

The sample application that we built for this post demonstrates a Python Django application sending email through SendGrid.

To launch this sample application yourself:

  1. Download a Stackato VM or sign up for the Stackato Sandbox on the Get Stackato page
  2. Follow the setup instructions in the Stackato Quick Start. Be sure to install a copy of the Stackato client.
  3. Target the "API endpoint" of the Stackato system you want to use. For example:
        $ stackato target
        $ stackato login
  4. Clone (or download and unzip) the sendgrid-stackato-django-demo sample application from Gitub.
  5. Change to the demo application base directory:
        $ cd sendgrid-stackato-django-demo/
  6. Push the application to Stackato. If you're using the Sandbox, choose your own unique application name (since "" is taken):
        $ stackato push -n myappname
    ... otherwise just use 'stackato push -n'.

The client reserves a URL for the app, pushes the application code, installs the language runtime (Python 2.7) and any modules that are required (Django). It then starts an instance of the application which you can open in your browser. Using the 'stackato open' command will do this for you.

The demo app asks for SendGrid username/password every time, so that we can deploy it safely. For real applications, you would want to set up these credentials in the file instead. We created a second branch, emailAuthSettings, that shows how this is done.

Email-as-a-Service for Platform-as-a-Service

There are a lot more to both Stackato and SendGrid than we can cover in one post. This is just a taste of how easily you can send email from Django applications. Be sure to check out examples using some of the other languages and frameworks supported by Stackato.

Subscribe to ActiveState Blogs by Email

Share this post:

Category: stackato
About the Author: RSS

Diane Mueller is a Cloud Evangelist at ActiveState. She has been designing & implementing financial applications at Fortune 500 corporations for over 20 years. Diane has been actively involved in development efforts of XBRL Open Standard ( since 1999.