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 raw-message value is used to create an InboundEmailMessage
object. This value should be a valid input to the EmailMessage
constructor (inherited by 'InboundEmailMessage').
Flask- This is typically the flask.request.form field (if
the user wants to pass single (non-list) values for each key), or
'dict(flask.request.form.lists())' if the user wants to store a list for
each key (example use case is multiple to and cc recipients).
Webob- webob.Request.POST can be used for single values, and
webob.Request.POST.dict_of_lists() for multiple values.
Django- request.POST can be used for single values, and
dict(request.POST.lists()) can be used for multiple values.
# Add logic for what to do with the bounce notificationprint('Bounce original: %s',bounce_msg.original)print('Bounce notification: %s',bounce_msg.notification)# Return suitable responseresponse=http.HTTPStatus.OKstart_response(f'{response.value}{response.phrase}',[])return['success'.encode('utf-8')]
Args
environ
a WSGI dict describing the HTTP request (See PEP 333).
[[["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 2022-09-30 UTC."],[[["This document describes the `BounceNotification` class, which is used to encapsulate bounce notifications received by an application, inheriting from `expected_type`."],["The `BounceNotification` object is initialized with a dictionary `post_vars` containing bounce information, including original and notification details of the email, as well as a raw message, and how to pass them using different frameworks is provided."],["The object has attributes `notification`, `original`, and `original_raw_message`, which store the parsed data from `post_vars`."],["The class method `from_environ` allows the creation of a `BounceNotification` object directly from an HTTP request body, demonstrated with a WSGI example."],["The keys of the `post_vars` dictionary include such items as `original-from` and `notification-to`, and the `raw-message` key takes in a valid input to the EmailMessage constructor."]]],[]]