# ``twisted`.`mail`.`bounce``

module documentation
(source)

Support for bounce message generation.

Function | `generateBounce` | Generate a bounce message for an undeliverable email message.
Constant | `BOUNCE_FORMAT` | Undocumented

def generateBounce(message, failedFrom, failedTo, transcript='', encoding='utf-8'): (source)
Generate a bounce message for an undeliverable email message.

Parameters
message:a file-like object | The undeliverable message.
failedFrom:`bytes` or `unicode` | The originator of the undeliverable message.
failedTo:`bytes` or `unicode` | The destination of the undeliverable message.
transcript:`bytes` or `unicode` | An error message to include in the bounce message.
encoding:`str` or `unicode` | Encoding to use, default: utf-8
Returns
3-`tuple` of (1) `bytes`, (2) `bytes`, (3) `bytes` | The originator, the destination and the contents of the bounce message. The destination of the bounce message is the originator of the undeliverable message.

BOUNCE_FORMAT: `str` = (source)

Undocumented

Value

    '''From: postmaster@{failedDomain}
    To: {failedFrom}
    Subject: Returned Mail: see transcript for details
    Message-ID: {messageID}
    Content-Type: multipart/report; report-type=delivery-status;
        boundary="{boundary}"

    ...