English | Site Directory

Overview

App Engine provides a service for sending email messages from web applications.

The sender ("From:") address of a message sent from an application can be either the email address of a registered administrator, or the email address of the current signed-in user (the user who made the request that is sending the message). Errors and bounce messages are sent to the sender address. The sender address also receives a copy of the message if it is the current signed-in user.

from google.appengine.api import mail

class ConfirmUserSignup(webapp.RequestHandler):
  def post(self):
    user_address = self.request.get("email_address")

    if not mail.is_email_valid(user_address):
      # prompt user to enter a valid address

    else:
      confirmation_url = createNewUserConfirmation(self.request)
      sender_address = "support@example.com"
      subject = "Confirm your registration"
      body = """
Thank you for creating an account!  Please confirm your email address by
clicking on the link below:

%s
""" % confirmation_url

      mail.send_mail(sender_address, user_address, subject, body)