/usr/lib/python3/dist-packages/twisted/mail/__pycache__
Edit: /usr/lib/python3/dist-packages/twisted/mail/__pycache__/bounce.cpython-310.pyc (2716B)
o
bb @ sN d Z ddlZddlZddlZddlmZmZmZ ddl m
Z
dZd
dd ZdS )z(
Support for bounce message generation.
N)SEEK_ENDSEEK_SETStringIO)smtpa] 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}"
--{boundary}
{transcript}
--{boundary}
Content-Type: message/delivery-status
Arrival-Date: {ctime}
Final-Recipient: RFC822; {failedTo}
utf-8c
C sV t |tr
||}t |tr||}|sdj|d}tj|d }dt t dt
t ||ddd ||tj
dd| |d }t }|tjdi | | }| d
t | } | |t | dkr | }
t |
tr}|
|}
t|
d
krn||
qon| }t |tr||}|| d||| |fS )a^
Generate a bounce message for an undeliverable email message.
@type message: a file-like object
@param message: The undeliverable message.
@type failedFrom: L{bytes} or L{unicode}
@param failedFrom: The originator of the undeliverable message.
@type failedTo: L{bytes} or L{unicode}
@param failedTo: The destination of the undeliverable message.
@type transcript: L{bytes} or L{unicode}
@param transcript: An error message to include in the bounce message.
@type encoding: L{str} or L{unicode}
@param encoding: Encoding to use, default: utf-8
@rtype: 3-L{tuple} of (E{1}) L{bytes}, (E{2}) L{bytes}, (E{3}) L{bytes}
@return: The originator, the destination and the contents of the bounce
message. The destination of the bounce message is the originator of
the undeliverable message.
zzI'm sorry, the following address has permanent errors: {failedTo}.
I've given up, and I will not retry the message again.
)failedTo z{}_{}_{}XXXXX@bounce)uniq) boundaryctime
failedAddressfailedDomain
failedFromr messageIDmessage
transcriptr i' N )
isinstancebytesdecodeformatemailutils parseaddrtimeosgetpidr splitr messageidr write
BOUNCE_FORMATtellseekr r readlinelenreadencodegetvalue)r r r r encodingr datafporigszlinemessageContentr r 5/usr/lib/python3/dist-packages/twisted/mail/bounce.pygenerateBounce$ sR
r5 )r r )
__doc__email.utilsr r r ior r r twisted.mailr r% r5 r r r r4
s