We Are Hiring

Send and Track Email with Google Glass


Posted on

Currently, sending an email with Google Glass is trivial, you just say “OK Glass, send a message to [Name]” and dictate your message. Done.

If you want a similar experience for your Glassware’s users and also the ability to track those emails (opens, clicks, bounces, etc.), SendGrid is your solution. This post provides the information needed to send and track emails via Glass using the Google Mirror API and SendGrid’s Python library.

The methods outlined here should be similar for integrating with other Glassware supported languages. You can find our complete list of official libraries at our documentation.

To get started, if you are new to the Google Mirror API, I suggest you take the time to read through the Overview and Quick Start guides before continuing with this post. Then try the Quick Start Project Demo which we will re-create on a Google App Engine instance.

Google Glass vignette

Now, we need to create the Glassware. In this case, I chose Python and you can begin with the Python Quick Start guide.

Here are a few tips that may help you get through the Quick Start even quicker, particularly when using the new Cloud Console interface:

  • Set authentication under the Application Settings in your Google App Engine console:
    Authentication Type = Google Accounts API
  • For step 2, if you are using the new Cloud Console interface, instead of clicking Services to enable the Google Mirror API, you will choose APIs under the APIs & Auth section in the menu.
  • For step 3, in the new Cloud Console interface the API Access section is now located at APIs & Auth -> Registered apps.
  • For step 4, these settings are located under APIs & Auth -> Consent screen in the new interface.
  • Steps 5 & 6 are performed on the APIs & Auth -> Registered Apps section within the new interface. Specifically, you’ll click the Register App button to create your Web App as described in step 5, then once created, click on the Web App’s name to edit the client settings as described in step 6. You will also find the Client ID and Client Secret as mentioned in in step 7 here.
  • Before going to the “Configure the project” section, go ahead and clone the mirror-quickstart-python project.
  • Then once you get to the “Deploying the project” step, you should be able to go to your newly created web app and view a screen similar to this one. If not, ping me and I’ll try to help.

Google Glass quickstart example

Using this web interface you can try out many of the key features of the Mirror API directly from your browser, then inspect and modify the corresponding code.

Now, lets get to the sending email part. SendGrid makes this process easy by providing you with a open source library. As a quick test you can integrate with the library in the main_handler.py file, inside the render_template function within the MainHandler class. When you hit the URL of your app, an email should have been triggered and received in your inbox.

Tracking emails can be done one of three ways. First, you can simply login to SendGrid.com and click on the Statistics, Email Activity or Email Reports tabs. Secondly, you can utilize our Event API and setup a webhook to listen for events such as opens and clicks and we’ll post them to your URL in near real-time. Thirdly, you can use our Web API and pull down the statistics as needed.

Email activity

I suggest you read the 5 Best Practices for Using SendGrid with Google App Engine for more details and more ideas for deep integrating email into your app, including handling incoming emails.

The following resources should prove useful as you continue exploring with Glass:

Note that when in the Playground, you may come across an authentication error, which is solved here.

Now, you have the raw tools using Python and the Google Mirror API to incorporate emails into your hosted Glassware.

Email from a Glasshole

If you choose to use another language, please see our other libraries. If you have a particular example you would like to see, please let me know in the comments or shoot me an email.


Elmer Thomas is SendGrid's Hacker in Residence. His mission is to help SendGrid live up to its slogan: "Email Delivery. Simplified" by improving the lives of developers, both internally and externally. Via all sorts of hackery, of course. Follow his exploits on Twitter and GitHub.

4 thoughts on “Send and Track Email with Google Glass

  1. Pingback: Send Email From Android Applications

  2. Pingback: Google Glass Tutorial Sends Email Visually

  3. Pingback: How to Develop Google Glass Glassware

  4. Pingback: Create the Ultimate Interactive Presentation: Reveal.js, Leap Motion, Google Glass and SendGrid

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>