Python 2.7 has reached end of support
and will be deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Python
2.7 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you migrate to the latest supported version of Python.
Stay organized with collections
Save and categorize content based on your preferences.
In order to receive email bounce notifications, you need to configure
your app to enable email notification and you need to create a handler
to handle those notifications.
Configuring Your App to Receive Bounce
Notifications
There are two parts to the configuration. First, you need to enable
notification. Second, you need to set the mapping between
/_ah/bounce and your bounce handler, so App Engine knows where to
POST the notification data. To configure your app to receive bounced email
notifications:
Add the following to your app.yaml file to enable notification:
inbound_services:-mail_bounce
Also in app.yaml, declare a mapping between
/_ah/bounce and the bounce notification handler in your code, for
example:
A bounce notification is an
automated message from an email system that there's been a problem with message
delivery. In your app, you'll need to create bounce handler code to receive and
process these notifications.
One way to write a bounce handler is to use the
BounceNotificationHandler
convenience class. If you go this route, you'll need to override its
receive() method, which is called with an
argument of the
BounceNotification
class. Whether you use the BounceNotificationHandler convenience class
or not, you do need to use BounceNotification to parse the bounce
notifications.
Both BounceNotificationHandler and BounceNotification
are in the google.appengine.ext.webapp.mail_handlers package.
Here is a sample bounce handler that uses the
BounceNotificationHandler convenience class:
classLogBounceHandler(BounceNotificationHandler):defreceive(self,bounce_message):logging.info('Received bounce post ... [%s]',self.request)logging.info('Bounce original: %s',bounce_message.original)logging.info('Bounce notification: %s',bounce_message.notification)
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-21 UTC."],[[["\u003cp\u003eThis content describes how to configure an app to receive email bounce notifications using legacy bundled services and APIs in the first-generation App Engine standard environment.\u003c/p\u003e\n"],["\u003cp\u003eTo receive bounce notifications, you must enable the \u003ccode\u003email_bounce\u003c/code\u003e inbound service in your \u003ccode\u003eapp.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eYou must also define a mapping in your \u003ccode\u003eapp.yaml\u003c/code\u003e file between the \u003ccode\u003e/_ah/bounce\u003c/code\u003e URL and your bounce notification handler.\u003c/p\u003e\n"],["\u003cp\u003eA bounce handler is needed to process the bounce notifications, which can be done using the \u003ccode\u003eBounceNotificationHandler\u003c/code\u003e or directly with the \u003ccode\u003eBounceNotification\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eBoth the \u003ccode\u003eBounceNotificationHandler\u003c/code\u003e and \u003ccode\u003eBounceNotification\u003c/code\u003e classes are located within the \u003ccode\u003egoogle.appengine.ext.webapp.mail_handlers\u003c/code\u003e package.\u003c/p\u003e\n"]]],[],null,[]]