View source on GitHub |
Encapsulates a bounce notification received by the application.
Inherits From: expected_type
google.appengine.api.mail.BounceNotification(
post_vars: typing.Mapping[str, typing.Any]
)
Args | |
---|---|
post_vars
|
a dictionary with keys as strings. This should
contain bounce information, and the following keys are handled:
original-from
original-to
original-cc
original-bcc
original-subject
original-text
notification-from
notification-to
notification-cc
notification-bcc
notification-subject
notification-text
raw-message
For all keys except 'raw-message', the value can be anything.
The Bounce Notification object just assigns these values to the
original and notification properties of this instance,
which are dictionaries.
For example, original["to"] = post_vars.get("original-to")
The Flask- This is typically the Webob- Django- |
Attributes | |
---|---|
notification
|
|
original
|
|
original_raw_message
|
Methods
from_environ
@classmethod
from_environ( environ )
Transforms the HTTP request body to a bounce notification object.
Example(WSGI)::
def BounceReceiver(environ, start_response): bounce_msg = mail.BounceNotification.from_environ(environ)
# Add logic for what to do with the bounce notification
print('Bounce original: %s', bounce_msg.original)
print('Bounce notification: %s', bounce_msg.notification)
# Return suitable response
response = http.HTTPStatus.OK
start_response(f'{response.value} {response.phrase}', [])
return ['success'.encode('utf-8')]
Args | |
---|---|
environ
|
a WSGI dict describing the HTTP request (See PEP 333). |
Returns | |
---|---|
A BounceNotification object. |