google.appengine.ext.webapp.mail_handlers module

Summary

Handler library for inbound Mail API.

Contains handlers to help with receiving mail and mail bounces.

InboundMailHandler:

Provides a helper method for easily setting up email receivers.

BounceNotificationHandler:

Provides a helper method for easily setting up a bounce notification receiver. Will parse HTTP request to extract the bounce notification.

Contents

class google.appengine.ext.webapp.mail_handlers.BounceNotification(post_vars)source

Bases: object

Encapsulates a bounce notification received by the application.

notification
original
original_raw_message
class google.appengine.ext.webapp.mail_handlers.BounceNotificationHandlersource

Bases: google.appengine.ext.webapp._webapp25.RequestHandler

Base class for bounce notification handlers.

Example:

# Sub-class overrides receive method.
class BounceLogger(BounceNotificationHandler):

  def receive(self, bounce_notification):
    logging.info('Received bounce from ' %
        bounce_notification.notification_from)


# Map bounce handler to application
application = webapp.WSGIApplication([
    BounceLogger.mapping(),
])
classmethod mapping()source

Convenience method to map handler class to application.

Returns

Mapping from bounce URL to bounce notification handler class.

post()source

Transforms POST body to bounce request.

receive(bounce_notification)source
class google.appengine.ext.webapp.mail_handlers.InboundMailHandlersource

Bases: google.appengine.ext.webapp._webapp25.RequestHandler

Base class for inbound mail handlers.

Example:

# Sub-class overrides receive method.
class HelloReceiver(InboundMailHandler):

  def receive(self, mail_message):
    logging.info('Received greeting from %s: %s' % (mail_message.sender,
                                                    mail_message.body))


# Map mail handler to appliction.
application = webapp.WSGIApplication([
    HelloReceiver.mapping(),
])
classmethod mapping()source

Convenience method to map handler class to application.

Returns

Mapping from email URL to inbound mail handler class.

post()source

Transforms body to email request.

receive(mail_message)source

Receive an email message.

Override this method to implement an email receiver.

Parameters

mail_message – InboundEmailMessage instance representing received email.

Send feedback about...

App Engine standard environment for Python