https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /usr/lib/python2.7/dist-packages/twisted/mail/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python2.7/dist-packages/twisted/mail/bounce.py
# -*- test-case-name: twisted.mail.test.test_bounce -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.


"""
Support for bounce message generation.
"""

import StringIO
import rfc822
import time
import os


from twisted.mail import smtp

BOUNCE_FORMAT = """\
From: postmaster@%(failedDomain)s
To: %(failedFrom)s
Subject: Returned Mail: see transcript for details
Message-ID: %(messageID)s
Content-Type: multipart/report; report-type=delivery-status;
    boundary="%(boundary)s"

--%(boundary)s

%(transcript)s

--%(boundary)s
Content-Type: message/delivery-status
Arrival-Date: %(ctime)s
Final-Recipient: RFC822; %(failedTo)s
"""



def generateBounce(message, failedFrom, failedTo, transcript=''):
    """
    Generate a bounce message for an undeliverable email message.

    @type message: L{bytes}
    @param message: The undeliverable message.

    @type failedFrom: L{bytes}
    @param failedFrom: The originator of the undeliverable message.

    @type failedTo: L{bytes}
    @param failedTo: The destination of the undeliverable message.

    @type transcript: L{bytes}
    @param transcript: An error message to include in the bounce message.

    @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.
    """
    if not transcript:
        transcript = '''\
I'm sorry, the following address has permanent errors: %(failedTo)s.
I've given up, and I will not retry the message again.
''' % {'failedTo': failedTo}

    failedAddress = rfc822.AddressList(failedTo)[0][1]
    data = {
        'boundary': "%s_%s_%s" % (time.time(), os.getpid(), 'XXXXX'),
        'ctime': time.ctime(time.time()),
        'failedAddress': failedAddress,
        'failedDomain': failedAddress.split('@', 1)[1],
        'failedFrom': failedFrom,
        'failedTo': failedTo,
        'messageID': smtp.messageid(uniq='bounce'),
        'message': message,
        'transcript': transcript,
        }

    fp = StringIO.StringIO()
    fp.write(BOUNCE_FORMAT % data)
    orig = message.tell()
    message.seek(2, 0)
    sz = message.tell()
    message.seek(0, orig)
    if sz > 10000:
        while 1:
            line = message.readline()
            if len(line)<=1:
                break
            fp.write(line)
    else:
        fp.write(message.read())
    return '', failedFrom, fp.getvalue()

https://t.me/RX1948 - 2025