ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/smtplib.cpython-311.opt-1.pyc

�

�fw���*�dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZgd�ZdZdZdZdZd	Zd
Zejdej��ZGd�d
e��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��Z Gd�de��Z!Gd�de��Z"Gd�de��Z#Gd�de��Z$d �Z%d!�Z&d"�Z'd#�Z(d$�Z)	ddl*Z*d%Z+n
#e,$rd&Z+YnwxYwGd'�d(��Z-e+r#Gd)�d*e-��Z.e�/d*��d+Z0Gd,�d-e-��Z1e2d.kr�d/�Z3e3d0��Z4e3d1���5d2��Z6e7d3��d4Z8	ej9�:��Z;e;sne8e;zZ8�"e7d6e<e8��z��e-d7��Z=e=�>d5��e=�?e4e6e8��e=�@��dSdS)8aSMTP/ESMTP client class.

This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Authentication) and RFC 2487 (Secure SMTP over TLS).

Notes:

Please remember, when doing ESMTP, that the names of the SMTP service
extensions are NOT the same thing as the option keywords for the RCPT
and MAIL commands!

Example:

  >>> import smtplib
  >>> s=smtplib.SMTP("localhost")
  >>> print(s.help())
  This is Sendmail version 8.8.4
  Topics:
      HELO    EHLO    MAIL    RCPT    DATA
      RSET    NOOP    QUIT    HELP    VRFY
      EXPN    VERB    ETRN    DSN
  For more info use "HELP <topic>".
  To report bugs in the implementation send email to
      sendmail-bugs@sendmail.org.
  For local information send email to Postmaster at your site.
  End of HELP info
  >>> s.putcmd("vrfy","someone@here")
  >>> s.getreply()
  (250, "Somebody OverHere <somebody@here.my.org>")
  >>> s.quit()
�N)�body_encode)
�
SMTPException�SMTPNotSupportedError�SMTPServerDisconnected�SMTPResponseException�SMTPSenderRefused�SMTPRecipientsRefused�
SMTPDataError�SMTPConnectError�
SMTPHeloError�SMTPAuthenticationError�	quoteaddr�	quotedata�SMTP�i��
s
i �z	auth=(.*)c��eZdZdZdS)rz4Base class for all exceptions raised by this module.N��__name__�
__module__�__qualname__�__doc__���./opt/alt/python311/lib64/python3.11/smtplib.pyrrHs������>�>�>�>rrc��eZdZdZdS)rz�The command or option is not supported by the SMTP server.

    This exception is raised when an attempt is made to run a command or a
    command with an option which is not supported by the server.
    NrrrrrrK����������rrc��eZdZdZdS)rz�Not connected to any SMTP server.

    This exception is raised when the server unexpectedly disconnects,
    or when an attempt is made to use the SMTP instance before
    connecting it to a server.
    NrrrrrrRs���������rrc��eZdZdZd�ZdS)ra2Base class for all exceptions that include an SMTP error code.

    These exceptions are generated in some instances when the SMTP
    server returns an error code.  The error code is stored in the
    `smtp_code' attribute of the error, and the `smtp_error' attribute
    is set to the error message.
    c�4�||_||_||f|_dS�N)�	smtp_code�
smtp_error�args)�self�code�msgs   r�__init__zSMTPResponseException.__init__cs���������3�K��	�	�	rN�rrrrr)rrrrrZs-�������� � � � � rrc��eZdZdZd�ZdS)rz�Sender address refused.

    In addition to the attributes set by on all SMTPResponseException
    exceptions, this sets `sender' to the string that the SMTP refused.
    c�D�||_||_||_|||f|_dSr")r#r$�senderr%)r&r'r(r-s    rr)zSMTPSenderRefused.__init__os)������������3��'��	�	�	rNr*rrrrrhs-��������(�(�(�(�(rrc��eZdZdZd�ZdS)r	z�All recipient addresses refused.

    The errors for each recipient are accessible through the attribute
    'recipients', which is a dictionary of exactly the same sort as
    SMTP.sendmail() returns.
    c�$�||_|f|_dSr")�
recipientsr%)r&r0s  rr)zSMTPRecipientsRefused.__init__}s��$����M��	�	�	rNr*rrrr	r	us-��������"�"�"�"�"rr	c��eZdZdZdS)r
z'The SMTP server didn't accept the data.Nrrrrr
r
�s������1�1�1�1rr
c��eZdZdZdS)rz&Error during connection establishment.Nrrrrrr�s������0�0�0�0rrc��eZdZdZdS)rz"The server refused our HELO reply.Nrrrrrr�s������,�,�,�,rrc��eZdZdZdS)r
zvAuthentication error.

    Most probably the server didn't accept the username/password
    combination provided.
    Nrrrrr
r
�rrr
c��tj�|��\}}||fdkr.|����d��r|Sd|zSd|zS)z�Quote a subset of the email addresses defined by RFC 821.

    Should be able to handle anything email.utils.parseaddr can handle.
    ��r7�<z<%s>)�email�utils�	parseaddr�strip�
startswith��
addrstring�displayname�addrs   rrr�sk��
��-�-�j�9�9��K���T��h�&�&������(�(��-�-�	����
�"�"��D�=�rc�^�tj�|��\}}||fdkr|S|S)Nr6)r9r:r;r>s   r�
_addr_onlyrC�s7����-�-�j�9�9��K���T��h�&�&����Krc	�`�tjddtjdt|����S)z�Quote data for email.

    Double leading '.', and change Unix newline '\n', or Mac '\r' into
    internet CRLF end-of-line.
    z(?m)^\.z..�(?:\r\n|\n|\r(?!\n))��re�sub�CRLF��datas rrr�s.���6�*�d�
��&��d�3�3�5�5�5rc�.�tjdd|��S)Ns(?m)^\.s..)rGrH)�bindatas r�_quote_periodsrN�s��
�6�+�u�g�.�.�.rc�8�tjdt|��S)NrErFrJs r�	_fix_eolsrP�s���F�*�D�$�7�7�7rTFc�H�eZdZdZdZdZdZdZdZdZ	dZ
eZddde
jdfd�Zd�Zd	�Zd
�Zd�Zd�Zd-d�Zd�Zd.d�Zd�Zd.d�Zd.d�Zd.d�Zd�Zd.d�Zd�Zd�Zd�Z d/d�Z!d/d�Z"d�Z#d�Z$e$Z%d�Z&d �Z'd!d"�d#�Z(d0d$�Z)d0d%�Z*d0d&�Z+d!d"�d'�Z,d1d(�Z-		d2d)�Z.		d3d*�Z/d+�Z0d,�Z1dS)4ra�This class manages a connection to an SMTP or ESMTP server.
    SMTP Objects:
        SMTP objects have the following attributes:
            helo_resp
                This is the message given by the server in response to the
                most recent HELO command.

            ehlo_resp
                This is the message given by the server in response to the
                most recent EHLO command. This is usually multiline.

            does_esmtp
                This is a True value _after you do an EHLO command_, if the
                server supports ESMTP.

            esmtp_features
                This is a dictionary, which, if the server supports ESMTP,
                will _after you do an EHLO command_, contain the names of the
                SMTP service extensions this server supports, and their
                parameters (if any).

                Note, all extension names are mapped to lower case in the
                dictionary.

        See each method's docstrings for details.  In general, there is a
        method of the same name to perform each SMTP command.  There is also a
        method called 'sendmail' that will do an entire mail transaction.
        rN�ehloFr7c���||_||_i|_d|_||_d|_|rC|�||��\}}|dkr$|���t||���|�	||_	dStj��}d|vr	||_	dSd}		tjtj
����}	n#tj$rYnwxYwd|	z|_	dS)aInitialize a new instance.

        If specified, `host` is the name of the remote host to which to
        connect.  If specified, `port` specifies the port to which to connect.
        By default, smtplib.SMTP_PORT is used.  If a host is specified the
        connect method is called, and if it returns anything other than a
        success code an SMTPConnectError is raised.  If specified,
        `local_hostname` is used as the FQDN of the local host in the HELO/EHLO
        command.  Otherwise, the local hostname is found using
        socket.getfqdn(). The `source_address` parameter takes a 2-tuple (host,
        port) for the socket to bind to as its source address before
        connecting. If the host is '' and port is 0, the OS default behavior
        will be used.

        �asciir��N�.z	127.0.0.1z[%s])�_host�timeout�esmtp_features�command_encoding�source_address�_auth_challenge_count�connect�closer�local_hostname�socket�getfqdn�
gethostbyname�gethostname�gaierror)
r&�host�portr_rXr[r'r(�fqdnrAs
          rr)z
SMTP.__init__�s��$��
���� ��� '���,���%&��"��	2��,�,�t�T�2�2�K�T�3��s�{�{��
�
����&�t�S�1�1�1��%�"0�D����
�>�#�#�D��d�{�{�&*��#�#�#�#���!�/��0B�0D�0D�E�E�D�D��������D�����&,�t�m��#�#�#s�%C�C�Cc��|Sr"r�r&s r�	__enter__zSMTP.__enter__s���rc���	|�d��\}}|dkrt||���n#t$rYnwxYw|���dS#|���wxYw)N�QUIT��)�docmdrrr^)r&r%r'�messages    r�__exit__z
SMTP.__exit__s��	� �J�J�v�.�.�M�D�'��s�{�{�+�D�'�:�:�:���%�	�	�	��D�	����
�J�J�L�L�L�L�L��D�J�J�L�L�L�L���s!�.1�A�
>�A�>�A�A-c��||_dS)z�Set the debug output level.

        A non-false value results in debug messages for connection and for all
        messages sent to and received from the server.

        N)�
debuglevel)r&rrs  r�set_debuglevelzSMTP.set_debuglevel"s��%����rc���|jdkrJttj������g|�Rdt
ji�dSt|dt
ji�dS)N��file)rr�print�datetime�now�time�sys�stderr�r&r%s  r�_print_debugzSMTP._print_debug+sk���?�Q����(�#�'�'�)�)�.�.�0�0�I�4�I�I�I�c�j�I�I�I�I�I��4�)�c�j�)�)�)�)�)rc��|�|std���|jdkr|�d||f|j��t	j||f||j��S)N�0Non-blocking socket (timeout=0) is not supportedrzconnect: to)�
ValueErrorrrr~r[r`�create_connection)r&rerfrXs    r�_get_socketzSMTP._get_socket1sm����w���O�P�P�P��?�Q������m�d�D�\�4�;N�O�O�O��'��t��g�(,�(;�=�=�	=r�	localhostc�R�|r||_|s�|�d��|�d��kr`|�d��}|dkrE|d|�||dzd�}}	t|��}n#t$rtd���wxYw|s|j}tjd|||��|�	|||j
��|_d|_|�
��\}}|jdkr#|�dt!|����||fS)apConnect to a host on a given port.

        If the hostname ends with a colon (`:') followed by a number, and
        there is no port specified, that suffix will be stripped off and the
        number interpreted as the port number to use.

        Note: This method is automatically invoked by __init__, if a host is
        specified during instantiation.

        �:rNruznonnumeric portzsmtplib.connect�connect:)r[�find�rfind�intr��OSError�default_portr{�auditr�rX�sockrv�getreplyrrr~�repr)r&rerfr[�ir'r(s       rr]zSMTP.connect;s8���	1�"0�D���	5����3���4�:�:�c�?�?�:�:��
�
�3���A��A�v�v�!�"�1�"�X�t�A��E�F�F�|�d��5��t�9�9�D�D��!�5�5�5�!�"3�4�4�4�5�����	%��$�D��	�#�T�4��6�6�6��$�$�T�4���>�>��	���	��m�m�o�o���s��?�Q������j�$�s�)�)�4�4�4��c�{�s�+A;�;Bc��|jdkr#|�dt|����|jr�t	|t
��r|�|j��}tj	d||��	|j�
|��dS#t$r$|���td���wxYwtd���)zSend `s' to the server.rzsend:zsmtplib.send�Server not connectedzplease run connect() firstN)rrr~r�r��
isinstance�str�encoderZr{r��sendallr�r^r)r&�ss  r�sendz	SMTP.send\s����?�Q������g�t�A�w�w�/�/�/��9�
	G��!�S�!�!�
4��H�H�T�2�3�3���I�n�d�A�.�.�.�
E��	�!�!�!�$�$�$�$�$���
E�
E�
E��
�
����,�-C�D�D�D�
E����)�)E�F�F�Fs�<B�.Cc���|dkr|}n|�d|��}d|vsd|vr<|�dd���dd��}td|�����|�|�t����dS)	zSend a command to the server.r7� �
�
z\nz\rz=command and arguments contain prohibited newline characters: N)�replacer�r�rI)r&�cmdr%r�s    r�putcmdzSMTP.putcmdos����2�:�:��A�A�������A��1�9�9���	�	��	�	�$��&�&�.�.�t�U�;�;�A��S�PQ�S�S���
�	
�	�	�Q�,��,�,�����rc��g}|j�|j�d��|_		|j�tdz��}nE#t
$r8}|���tdt|��z���d}~wwxYw|s#|���td���|j	dkr#|�
dt|����t|��tkr$|���tdd	���|�|d
d��d����|dd�}	t!|��}n#t"$rd
}YnwxYw|dd
�dkrn��fd�|��}|j	dkr|�
d|�d|����||fS)a�Get a reply from the server.

        Returns a tuple consisting of:

          - server response code (e.g. '250', or such, if all goes well)
            Note: returns -1 if it can't read response code.

          - server response string corresponding to response code (multiline
            responses are converted to a single, multiline string).

        Raises SMTPServerDisconnected if end-of-file is reached.
        N�rbruz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:i�zLine too long.�s 	
�����-�
zreply: retcode (z); Msg: )rvr��makefile�readline�_MAXLINEr�r^rr�rrr~r��lenr�appendr<r�r��join)r&�resp�line�er'�errcode�errmsgs       rr�z
SMTP.getreply|s������9���	�*�*�4�0�0�D�I�	�
7��y�)�)�(�Q�,�7�7�����
7�
7�
7��
�
����,�-O�/2�1�v�v�.6�7�7�7�����
7�����
O��
�
����,�-M�N�N�N����"�"��!�!�(�D��J�J�7�7�7��4�y�y�8�#�#��
�
����+�C�1A�B�B�B��K�K��Q�R�R����z�2�2�3�3�3�����8�D�
��d�)�)�����
�
�
�����
�����A�a�C�y�D� � ��5	�8���D�!�!���?�Q������������P�Q�Q�Q����s)�"A�
B�3B�B�E-�-E<�;E<c�V�|�||��|���S)z-Send a command, and return its response code.�r�r�)r&r�r%s   rrnz
SMTP.docmd�s$�����C������}�}���rc��|�d|p|j��|���\}}||_||fS)zwSMTP 'helo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        �helo)r�r_r��	helo_resp)r&�namer'r(s    rr�z	SMTP.helo�sB��
	
���F�D�7�D�$7�8�8�8��m�m�o�o���s�����c�{�rc��i|_|�|j|p|j��|���\}}|dkr6t|��dkr#|���td���||_|dkr||fSd|_	|j�
d���d��}|d=|D�]}t�
|��}|rC|j�dd	��d
z|�d��dz|jd<�bt!j
d|��}|r�|�d�����}|j|�d��d
����}	|dkr+|j�|d	��d
z|	z|j|<��|	|j|<��||fS)zx SMTP 'ehlo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        r�rr��Tzlatin-1r��authr7r�z((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?�featureN)rYr��ehlo_msgr_r�r�r^r�	ehlo_resp�
does_esmtp�decode�split�
OLDSTYLE_AUTH�match�get�groupsrG�group�lower�string�endr<)
r&r�r'r(r��each�
auth_match�mr��paramss
          rrRz	SMTP.ehlo�s���
!������D�M�4�#>�4�+>�?�?�?��m�m�o�o���s��2�:�:�#�c�(�(�a�-�-��J�J�L�L�L�(�)?�@�@�@�����3�;�;��#�;������~�$�$�Y�/�/�5�5�d�;�;����G��	:�	:�D�'�,�,�T�2�2�J��
�.2�.A�.E�.E�f�b�.Q�.Q��/� *� 1� 1�!� 4� 4�Q� 7�/8��#�F�+����D�d�K�K�A��
:��'�'�)�,�,�2�2�4�4����!�%�%�	�"2�"2�"3�"3�4�:�:�<�<���f�$�$�37�3F�3J�3J�7�TV�3W�3W�!�4"�$*�4+�D�'��0�0�4:�D�'��0���c�{�rc�8�|���|jvS)z7Does the server support a given SMTP service extension?)r�rY)r&�opts  r�has_extnz
SMTP.has_extn�s���y�y�{�{�d�1�1�1rc�b�|�d|��|���dS)z;SMTP 'help' command.
        Returns help text from server.�helprur�r}s  rr�z	SMTP.help�s+��	
���F�D�!�!�!��}�}���q�!�!rc�:�d|_|�d��S)z&SMTP 'rset' command -- resets session.rT�rset)rZrnris rr�z	SMTP.rset�s�� '����z�z�&�!�!�!rc�R�	|���dS#t$rYdSwxYw)aInternal 'rset' command which ignores any SMTPServerDisconnected error.

        Used internally in the library, since the server disconnected error
        should appear to the application when the *next* command is issued, if
        we are doing an internal "safety" reset.
        N)r�rris r�_rsetz
SMTP._rset�s:��	��I�I�K�K�K�K�K��%�	�	�	��D�D�	���s��
&�&c�,�|�d��S)z-SMTP 'noop' command -- doesn't do anything :>�noop)rnris rr�z	SMTP.noops���z�z�&�!�!�!rrc�J�d}|rd|jr]td�|D����r,|�d��rd|_nt	d���dd�|��z}|�ddt|���|����|���S)	a8SMTP 'mail' command -- begins mail xfer session.

        This method may raise the following exceptions:

         SMTPNotSupportedError  The options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.
        r7c3�FK�|]}|���dkV��dS)�smtputf8N)r�)�.0�xs  r�	<genexpr>zSMTP.mail.<locals>.<genexpr>s/����:�:�Q�1�7�7�9�9�j�(�:�:�:�:�:�:rr�zutf-8z SMTPUTF8 not supported by serverr��mailzFROM:)	r��anyr�rZrr�r�rr�)r&r-�options�
optionlists    rr�z	SMTP.mails����
��	1�t��	1��:�:�'�:�:�:�:�:�
<��=�=��,�,�<�,3�D�)�)�/�:�<�<�<��s�x�x��0�0�0�J����F�F�9�V�+<�+<�+<�j�j�I�J�J�J��}�}���rc��d}|r|jrdd�|��z}|�ddt|���|����|���S)z;SMTP 'rcpt' command -- indicates 1 recipient for this mail.r7r��rcptzTO:)r�r�r�rr�)r&�recipr�r�s    rr�z	SMTP.rcpt$sd���
��	1�t��	1��s�x�x��0�0�0�J����F�F��5�)9�)9�)9�:�:�F�G�G�G��}�}���rc�R�|�d��|���\}}|jdkr|�d||f��|dkrt	||���t|t��r"t|���d��}t|��}|dd�tkr
|tz}|dztz}|�|��|���\}}|jdkr|�d||f��||fS)	a�SMTP 'DATA' command -- sends message data to server.

        Automatically quotes lines beginning with a period per rfc821.
        Raises SMTPDataError if there is an unexpected reply to the
        DATA command; the return value from this method is the final
        response code received when the all data is sent.  If msg
        is a string, lone '\r' and '\n' characters are converted to
        '\r\n' characters.  If msg is bytes, it is transmitted as is.
        rKrzdata:ibrT���N�.)r�r�rrr~r
r�r�rPr�rN�bCRLFr�)r&r(r'�repl�qs     rrKz	SMTP.data,s��	
���F�����}�}�����t��?�Q������g��d�|�4�4�4��3�;�;���d�+�+�+��#�s�#�#�
5���n�n�+�+�G�4�4���s�#�#�A�����v������I���D��5� �A��I�I�a�L�L�L��-�-�/�/�K�T�3����"�"��!�!�'�D�#�;�7�7�7��#�;�rc�p�|�dt|����|���S)z5SMTP 'verify' command -- checks for address validity.�vrfy�r�rCr��r&�addresss  r�verifyzSMTP.verifyI�,�����F�J�w�/�/�0�0�0��}�}���rc�p�|�dt|����|���S)z.SMTP 'expn' command -- expands a mailing list.�expnr�r�s  rr�z	SMTP.expnPr�rc���|j�d|j�_d|���dcxkrdks<n|���\}}d|cxkrdksnt	||���dSdSdSdS)abCall self.ehlo() and/or self.helo() if needed.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        N��ri+)r�r�rRr�r)r&r'r�s   r�ehlo_or_helo_if_neededzSMTP.ehlo_or_helo_if_neededWs����>�!�d�n�&<��4�9�9�;�;�q�>�0�0�0�0�S�0�0�0�0�#�y�y�{�{���t��t�*�*�*�*�s�*�*�*�*�'��d�3�3�3�	"�!�&<�&<�0�0�*�*rT��initial_response_okc��|���}|r
|��nd}|�Kt|�d��d���}|�d|dz|z��\}}d|_n |�d|��\}}d|_|d	kr�|xjdz
c_tj|��}t||���d��d���}|�|��\}}|jtkr!td
t||f��z���|d	k��|dvr||fSt||���)a�Authentication command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - the valid values are those listed in the 'auth'
        element of 'esmtp_features'.

        'authobject' must be a callable object taking a single argument:

                data = authobject(challenge)

        It will be called to process the server's challenge response; the
        challenge argument it is passed will be a bytes.  It should return
        an ASCII string that will be base64 encoded and sent to the server.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.
        NrTr7)�eol�AUTHr�ruriNz4Server AUTH mechanism infinite loop. Last response: ���i�)�upper�
encode_base64r�rnr\�base64�decodebytes�
_MAXCHALLENGErr�r
)	r&�	mechanism�
authobjectr��initial_response�responser'r��	challenges	         rr�z	SMTP.authhsu��,�O�O�%�%�	�,?�I�J�J�L�L�L�T���'�$�%5�%<�%<�W�%E�%E�2�N�N�N�H��:�:�f�i�#�o��.H�I�I�L�T�4�)*�D�&�&��:�:�f�i�8�8�L�T�4�)*�D�&��c�k�k��&�&�!�+�&�&��*�4�0�0�I�$��
�9�%�%�,�,�W�5�5�2�?�?�?�H��:�:�h�/�/�L�T�4��)�M�9�9�#�J��D�$�<�(�(�)�����c�k�k��:����$�<��%�d�D�1�1�1rc��|�dS|jdztj|j�d��|d�����zS)zh Authobject to use with CRAM-MD5 authentication. Requires self.user
        and self.password to be set.Nr�rT�md5)�user�hmac�HMAC�passwordr��	hexdigest�r&rs  r�
auth_cram_md5zSMTP.auth_cram_md5�sR�����4��y�3�����M� � ��)�)�9�e�"=�"=�=F�Y�[�[�I�	Irc�&�d|j�d|j��S)ze Authobject to use with PLAIN authentication. Requires self.user and
        self.password to be set.�)rrrs  r�
auth_plainzSMTP.auth_plain�s���"�Y�Y�Y��
�
�6�6rc�8�|�|jdkr|jS|jS)ze Authobject to use with LOGIN authentication. Requires self.user and
        self.password to be set.N�)r\rrrs  r�
auth_loginzSMTP.auth_login�s'����� :�Q� >� >��9���=� rc���|���|�d��std���|jd����gd�}�fd�|D��}|std���||c|_|_|D]z}d|����	dd��z}	|�
|t||��|�	��\}}	|d
vr||	fcS�b#t$r}
|
}Yd}
~
�sd}
~
wwxYw|�)awLog in on an SMTP server that requires authentication.

        The arguments are:
            - user:         The user name to authenticate with.
            - password:     The password for the authentication.

        Keyword arguments:
            - initial_response_ok: Allow sending the RFC 4954 initial-response
              to the AUTH command, if the authentication methods supports it.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        This method will return normally if the authentication was successful.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
         SMTPAuthenticationError  The server didn't accept the username/
                                  password combination.
         SMTPNotSupportedError    The AUTH command is not supported by the
                                  server.
         SMTPException            No suitable authentication method was
                                  found.
        r�z,SMTP AUTH extension not supported by server.)zCRAM-MD5�PLAIN�LOGINc���g|]}|�v�|��	Srr)r�r��advertised_authlists  �r�
<listcomp>zSMTP.login.<locals>.<listcomp>�s.���4�4�4�T��2�2�2��2�2�2rz(No suitable authentication method found.�auth_�-�_r�r�N)
r�r�rrYr�rrrr�r�r��getattrr
)
r&rrr��preferred_auths�authlist�
authmethod�method_namer'r�r��last_exceptionrs
            @r�loginz
SMTP.login�s~���8	
�#�#�%�%�%��}�}�V�$�$�	@�'�>�@�@�
@�#�1�&�9�?�?�A�A��9�8�8��4�4�4�4�_�4�4�4���	L�� J�K�K�K�
$(�� ��	�4�=�"�	#�	#�J�!�J�$4�$4�$6�$6�$>�$>�s�C�$H�$H�H�K�	
#�#�y�y����k� :� :�(;� )� =� =���t�
�:�%�%� �$�<�'�'�'�&��*�
#�
#�
#�!"�����������
#�����s�;0C/�/
D�9D�Dc�Z�|���|�d��std���|�d��\}}|dkr�tstd���|�|�t
d���|�|�t
d���|�|� d	dl}|�d
td��|�tj||���}|�|j
|j�
��|_
d|_d|_d|_i|_d|_nt)||���||fS)a�Puts the connection to the SMTP server into TLS mode.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.

        If the server supports TLS, this will encrypt the rest of the SMTP
        session. If you provide the keyfile and certfile parameters,
        the identity of the SMTP server and client can be checked. This,
        however, depends on whether the socket module really checks the
        certificates.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        �starttlsz+STARTTLS extension not supported by server.�STARTTLSrUz&No SSL support included in this PythonN�4context and keyfile arguments are mutually exclusive�5context and certfile arguments are mutually exclusiver�Akeyfile and certfile are deprecated, use a custom context insteadr��certfile�keyfile��server_hostnameF)r�r�rrn�	_have_ssl�RuntimeErrorr��warnings�warn�DeprecationWarning�ssl�_create_stdlib_context�wrap_socketr�rWrvr�r�rYr�r)r&r0r/�contextr��replyr5s       rr)z
SMTP.starttls�s��"	
�#�#�%�%�%��}�}�Z�(�(�	?�'�=�?�?�
?��
�
�:�.�.�
��u��3�;�;��
M�"�#K�L�L�L��"�w�':� �"-�.�.�.��"�x�';� �"-�.�.�.��"�h�&:������
�
�7�8J�A�O�O�O����4�h�=D�F�F�F���+�+�D�I�<@�J�,�H�H�D�I��D�I�
"�D�N�!�D�N�"$�D��#�D�O�O�
(��e�4�4�4��e�}�rc�<�|���g}t|t��r"t|���d��}|jrT|�d��r%|�dt|��z��|D]}|�|���|�	||��\}}	|dkr@|dkr|�
��n|���t||	|���i}
t|t��r|g}|D]W}|�
||��\}}	|dkr
|dkr||	f|
|<|dkr#|�
��t|
����Xt|
��t|��kr#|���t|
���|�|��\}}	|dkr?|dkr|�
��n|���t!||	���|
S)a|This command performs an entire mail transaction.

        The arguments are:
            - from_addr    : The address sending this mail.
            - to_addrs     : A list of addresses to send this mail to.  A bare
                             string will be treated as a list with 1 address.
            - msg          : The message to send.
            - mail_options : List of ESMTP options (such as 8bitmime) for the
                             mail command.
            - rcpt_options : List of ESMTP options (such as DSN commands) for
                             all the rcpt commands.

        msg may be a string containing characters in the ASCII range, or a byte
        string.  A string is encoded to bytes using the ascii codec, and lone
        \r and \n characters are converted to \r\n characters.

        If there has been no previous EHLO or HELO command this session, this
        method tries ESMTP EHLO first.  If the server does ESMTP, message size
        and each of the specified options will be passed to it.  If EHLO
        fails, HELO will be tried and ESMTP options suppressed.

        This method will return normally if the mail is accepted for at least
        one recipient.  It returns a dictionary, with one entry for each
        recipient that was refused.  Each entry contains a tuple of the SMTP
        error code and the accompanying error message sent by the server.

        This method may raise the following exceptions:

         SMTPHeloError          The server didn't reply properly to
                                the helo greeting.
         SMTPRecipientsRefused  The server rejected ALL recipients
                                (no mail was sent).
         SMTPSenderRefused      The server didn't accept the from_addr.
         SMTPDataError          The server replied with an unexpected
                                error code (other than a refusal of
                                a recipient).
         SMTPNotSupportedError  The mail_options parameter includes 'SMTPUTF8'
                                but the SMTPUTF8 extension is not supported by
                                the server.

        Note: the connection will be open even after an exception is raised.

        Example:

         >>> import smtplib
         >>> s=smtplib.SMTP("localhost")
         >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"]
         >>> msg = '''\
         ... From: Me@my.org
         ... Subject: testin'...
         ...
         ... This is a test '''
         >>> s.sendmail("me@my.org",tolist,msg)
         { "three@three.org" : ( 550 ,"User unknown" ) }
         >>> s.quit()

        In the above example, the message was accepted for delivery to three
        of the four addresses, and one was rejected, with the error code
        550.  If all addresses are accepted, then the method will return an
        empty dictionary.

        rT�sizezsize=%dr�i��)r�r�r�rPr�r�r�r�r�r�r^r�rr�r	rKr
)r&�	from_addr�to_addrsr(�mail_options�rcpt_options�
esmtp_opts�optionr'r��senderrsr�s            r�sendmailz
SMTP.sendmail(s��@	
�#�#�%�%�%��
��c�3���	1��C�.�.�'�'��0�0�C��?�	*��}�}�V�$�$�
8��!�!�)�c�#�h�h�"6�7�7�7�&�
*�
*���!�!�&�)�)�)�)��y�y��J�7�7���t��3�;�;��s�{�{��
�
������
�
����#�D�$�	�:�:�:����h��$�$�	"� �z�H��	6�	6�D��9�9�T�<�8�8�L�T�4�����$�#�+�+�"&�������s�{�{��
�
����+�H�5�5�5���x�=�=�C��M�M�)�)��J�J�L�L�L�'��1�1�1��y�y��~�~���t��3�;�;��s�{�{��
�
������
�
������d�+�+�+��rc��|���|�d��}|�d}n%t|��dkrd}ntd���|�I|dz|vr||dzn
||dz}tj�|g��d	d}|�Sd
�||dz||dz||d
zfD��}d�tj�|��D��}tj|��}	|	d=|	d=d}
	d�|g|����	d��n6#t$r)|�d��std���d}
YnwxYwtj��5}|
rDtj�||j�d������}g|�d�d�R}ntj�|��}|�|	d���|���}
ddd��n#1swxYwY|�|||
||��S)a~Converts message to a bytestring and passes it to sendmail.

        The arguments are as for sendmail, except that msg is an
        email.message.Message object.  If from_addr is None or to_addrs is
        None, these arguments are taken from the headers of the Message as
        described in RFC 2822 (a ValueError is raised if there is more than
        one set of 'Resent-' headers).  Regardless of the values of from_addr and
        to_addr, any Bcc field (or Resent-Bcc field, when the Message is a
        resent) of the Message object won't be transmitted.  The Message
        object is then serialized using email.generator.BytesGenerator and
        sendmail is called to transmit the message.  If the sender or any of
        the recipient addresses contain non-ASCII and the server advertises the
        SMTPUTF8 capability, the policy is cloned with utf8 set to True for the
        serialization, and SMTPUTF8 and BODY=8BITMIME are asserted on the send.
        If the server does not support SMTPUTF8, an SMTPNotSupported error is
        raised.  Otherwise the generator is called without modifying the
        policy.

        zResent-DateNr7ruzResent-z0message has more than one 'Resent-' header block�Sender�Fromrc��g|]}|�|��Sr"r)r��fs  rrz%SMTP.send_message.<locals>.<listcomp>�s(��-�-�-�� �m��,�m�mr�To�Bcc�Ccc��g|]
}|d��S)rur)r��as  rrz%SMTP.send_message.<locals>.<listcomp>�s��L�L�L���!��L�L�Lrz
Resent-BccFrTr�z�One or more source or delivery addresses require internationalized email support, but the server does not advertise the required SMTPUTF8 capabilityT)�utf8)�policy�SMTPUTF8z
BODY=8BITMIMEr)�linesep)r��get_allr�r�r9r:�getaddresses�copyr�r��UnicodeEncodeErrorr�r�io�BytesIO�	generator�BytesGeneratorrS�clone�flatten�getvaluerG)r&r(r@rArBrC�resent�
header_prefix�addr_fields�msg_copy�
international�bytesmsg�g�flatmsgs              r�send_messagezSMTP.send_message�s���>	
�#�#�%�%�%����]�+�+���>��M�M�
��[�[�A�
�
�%�M�M��O�P�P�P��� -�x�7�C�?�?��]�X�5�6�6� #�M�F�$:� ;�
���0�0�)��=�=�a�@��C�I���-�-�s�=�4�+?�'@�'*�=�5�+@�'A�'*�=�4�+?�'@�'B�-�-�-�K�M�L�e�k�&>�&>�{�&K�&K�L�L�L�H��9�S�>�>���U�O��\�"��
�	!��G�G�Y�*��*�+�+�2�2�7�;�;�;�;��!�	!�	!�	!��=�=��,�,�
L�+�K�L�L�L�!�M�M�M�
	!�����Z�\�\�	*�X��
=��O�2�2��S�Z�%5�%5�4�%5�%@�%@�3�B�B��K��K�z�K�?�K�K����O�2�2�8�<�<��
�I�I�h��I�/�/�/��'�'�)�)�G�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*�	*����	*�	*�	*�	*��}�}�Y��'�<�)�+�+�	+s%�+D=�=0E0�/E0�BH#�#H'�*H'c���	|j}d|_|r|���|j}d|_|r|���dSdS#|j}d|_|r|���wwxYw)z(Close the connection to the SMTP server.N)rvr^r�)r&rvr�s   rr^z
SMTP.close�s���		��9�D��D�I��
��
�
�����9�D��D�I��
��
�
������
�
���9�D��D�I��
��
�
�����
���s�$A�'A5c��|�d��}dx|_|_i|_d|_|���|S)zTerminate the SMTP session.�quitNF)rnr�r�rYr�r^)r&�ress  rrlz	SMTP.quit�sB���j�j�� � ��*.�.����� �������
�
�����
r�r�rN)r7)rr")NNN)rr)NNrr)2rrrrrrr�rvr�r�r�r��	SMTP_PORTr�r`�_GLOBAL_DEFAULT_TIMEOUTr)rjrprsr~r�r]r�r�r�rnr�rRr�r�r�r�r�r�r�rKr�r�r�r�r�rrrr'r)rGrir^rlrrrrr�s���������8�J��D��D��I��H��I��J��L��Q�t��7� $�.4�.4�.4�.4�`������%�%�%�*�*�*�=�=�=�����BG�G�G�& � � � �/�/�/�b��������1�1�1�1�f2�2�2�"�"�"�"�"�"�"�

�
�
�"�"�"�����*�������:���
�D����4�4�4�"BF�.2�.2�.2�.2�.2�`I�I�I�I�7�7�7�7�
!�!�!�!�<@�@�@�@�@�@�D6�6�6�6�p?A� �f�f�f�f�P:>�35�K+�K+�K+�K+�Z�������rrc�H��eZdZdZeZdddddejddfd�Z�fd�Z	�xZ
S)�SMTP_SSLa� This is a subclass derived from SMTP that connects over an SSL
        encrypted socket (to use this class you need a socket module that was
        compiled with SSL support). If host is not specified, '' (the local
        host) is used. If port is omitted, the standard SMTP-over-SSL port
        (465) is used.  local_hostname and source_address have the same meaning
        as they do in the SMTP class.  keyfile and certfile are also optional -
        they can contain a PEM formatted private key and certificate chain file
        for the SSL connection. context also optional, can contain a
        SSLContext, and is an alternative to keyfile and certfile; If it is
        specified both keyfile and certfile must be None.

        r7rNc	�2�|�|�td���|�|�td���|�|� ddl}	|	�dtd��||_||_|�t
j||���}||_t�
||||||��dS)Nr+r,rr-rr.)r�r5r6r7r0r/r8r9r;rr))
r&rerfr_r0r/rXr[r;r5s
          rr)zSMTP_SSL.__init__s����"�w�':� �"-�.�.�.��"�x�';� �"-�.�.�.��"�h�&:������
�
�7�8J�A�O�O�O�"�D�L�$�D�M����4�h�=D�F�F�F��"�D�L��M�M�$��d�N�G�(�
*�
*�
*�
*�
*rc����|jdkr|�d||f��t���|||��}|j�||j���}|S)Nrr�r1)rrr~�superr�r;r:rW)r&rerfrX�
new_socket�	__class__s     �rr�zSMTP_SSL._get_socketsp������"�"��!�!�*�t�T�l�;�;�;����,�,�T�4��A�A�J���1�1�*�BF�*�2�N�N�J��r)rrrr�
SMTP_SSL_PORTr�r`rpr)r��
__classcell__�rws@rrrrr�st�������	�	�%�� "��4�!�D�#�;�$(�$�	*�	*�	*�	*�.	�	�	�	�	�	�	�	�	rrri�c�H��eZdZdZdZdeddejf�fd�	Zd	�fd�	Z	�xZ
S)
�LMTPa�LMTP - Local Mail Transfer Protocol

    The LMTP protocol, which is very similar to ESMTP, is heavily based
    on the standard SMTP client. It's common to use Unix sockets for
    LMTP, so our connect() method must support that as well as a regular
    host:port server.  local_hostname and source_address have the same
    meaning as they do in the SMTP class.  To specify a Unix socket,
    you must use an absolute path as the host, starting with a '/'.

    Authentication is supported, using the regular SMTP mechanism. When
    using a Unix socket, LMTP generally don't support or require any
    authentication, but your mileage might vary.�lhlor7Nc�T��t���|||||���dS)zInitialize a new instance.)r_r[rXN)rur))r&rerfr_r[rXrws      �rr)z
LMTP.__init__<s@���	������t�N�(6��	�	I�	I�	I�	I�	Irr�rc����|ddkr$t���|||���S|j�|jstd���	t	jtjtj��|_|jtjur|j�	|j��d|_
|j�|��nW#t$rJ|jdkr|�
d|��|jr|j���d|_�wxYw|���\}}|jdkr|�
d|��||fS)z=Connect to the LMTP daemon, on either a Unix or a TCP socket.r�/)r[Nr�z
connect fail:r�)rur]rXr�r`�AF_UNIX�SOCK_STREAMr�rp�
settimeoutrvr�rrr~r^r�)r&rerfr[r'r(rws      �rr]zLMTP.connectBsS�����7�c�>�>��7�7�?�?�4��n�?�M�M�M��<�#�D�L�#��O�P�P�P�	��
�f�n�f�6H�I�I�D�I��|�6�#A�A�A��	�$�$�T�\�2�2�2��D�I��I���d�#�#�#�#���	�	�	����"�"��!�!�/�4�8�8�8��y�
"��	���!�!�!��D�I��
	�����m�m�o�o���s��?�Q������j�#�.�.�.��c�{�s�BC�AD&rn)rrrrr��	LMTP_PORTr`rpr)r]ryrzs@rr|r|,s��������4�4��H��Y�t� $�f�.L�I�I�I�I�I�I����������rr|�__main__c���tj�|dz��tj���tj������S)Nz: )r{�stdout�write�flush�stdinr�r<)�prompts rr�r�asP���
����$��'�'�'��
�������y�!�!�#�#�)�)�+�+�+rrJrM�,zEnter message, end with ^D:r7ruzMessage length is %dr�)Arr`rZrG�email.utilsr9�
email.message�email.generatorrrrXrxr{�email.base64mimerr�__all__rorxrIr�r�r�compile�Ir�r�rrrrrr	r
rrr
rrCrrNrPr8r3�ImportErrorrrrr�r�r|rr��fromaddrr��toaddrsrwr(r�r�r�r��serverrsrGrlrrr�<module>r�s�����R�
�
�
�	�	�	�	�	�	�	�	�������������
�
�
�
�������������
�
�
�
�9�9�9�9�9�9�-�-�-��

�	��
�
�������
���
�<���.�.�
�?�?�?�?�?�G�?�?�?������M���������]���� � � � � �M� � � �(�(�(�(�(�-�(�(�(�
"�
"�
"�
"�
"�M�
"�
"�
"�2�2�2�2�2�)�2�2�2�1�1�1�1�1�,�1�1�1�-�-�-�-�-�)�-�-�-������3����������5�5�5�/�/�/�8�8�8���J�J�J��I�I�������I�I�I�����t�t�t�t�t�t�t�t�l
�1�-�-�-�-�-�4�-�-�-�^�N�N�:����

�	�/�/�/�/�/�4�/�/�/�h�z���,�,�,�
�v�f�~�~�H��f�T�l�l� � ��%�%�G�	�E�
'�(�(�(�
�C���y�!�!�#�#���	���D�j��	�

�E�
 �3�3�s�8�8�
+�,�,�,�
�T�+�
�
�F�
���!����
�O�O�H�g�s�+�+�+�
�K�K�M�M�M�M�M�)�s�7C>�>D�D

Zerion Mini Shell 1.0