Sending notification e-mails

It's very common for web applications to send notifications to the users, and e-mails are a cheap and effective channel for delivering. The Notes application could benefit from a notification system as well: early in this chapter, we modified the shrink image function so that it runs in a task queue. Users receive a response immediately, but the actual job is put in a queue and they don't know if and when shrink operations complete successfully.

As we can send e-mail messages from an App Engine application on behalf of the administrators or users with Google Accounts, we send a message to the user as soon as the shrink operation is completed.

We first import the mail package in the main.py module:

from google.appengine.api ...

Get Python for Google App Engine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.