Today’s guest post is from Adam DuVander, Developer Communications Director at SendGrid. SendGrid is a cloud-based email service that delivers email on behalf of companies to increase deliverability and improve customer communications. Integration with new or existing email systems is done via SMTP or through a REST API. In this post, Adam shows how to integrate SendGrid into Google App Engine.

Whether you’re developing apps for the web or mobile environments, you need an effective way to communicate with your customers. Building and maintaining your own SMTP infrastructure can be resource intensive and costly. SendGrid eliminates the cost and complexity of maintaining your own email infrastructure so you can focus on developing the next extraordinary app.

Google App Engine developers can easily integrate SendGrid into their applications. In the example below, I’ll show you how to use our Python library. Java and PHP developers, we have you covered with libraries, too. Any App Engine developer can sign up for SendGrid and send 25,000 emails per month* for free, so get an account and follow along in the code editor of your choice.

First, copy the SendGrid Python library into your project by placing the files in a sendgrid sub-directory. When you import this library into your app you'll be able to create SendGrid instances and send mail with simple commands.

At the top of your app's .py file, import the Sendgrid library:
from sendgrid import Sendgrid
from sendgrid import Message
Now, from within your app, you can send email with the following few lines:
# make a secure connection to SendGrid
s = sendgrid.Sendgrid('', '', secure=True)
# make a message object
message = sendgrid.Message("", "message subject", "plaintext message body", 
"<strong>HTML message body</strong>")
# add a recipient
message.add_to("", "John Doe")
# use the Web API to send your message
In addition to working hard to get your email to an inbox, SendGrid also provides a lot data about your emails. For example, our Event API can tell you when an email is delivered, opened, clicked or bounced, among several other events. The same way that Google App Engine is a platform that makes hosting and scaling apps easy, SendGrid simplifies your interaction with email.

Sign up for SendGrid* to claim your 25,000 emails per month for free and combine the power of email and Google App Engine.

*Google will be compensated for customers who sign up for a non-free account

Contributed by Adam DuVander, Developer Communications Director, SendGrid

-Posted by Boyar Naito, Partner Development Manager