AlkantarClanX12

Your IP : 3.145.109.144


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/smtplib.cpython-310.opt-2.pyc

o

6��fw��@sV	ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Zgd�ZdZdZdZdZdZd	Ze�d
ej�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"Gdd�de�Z#dd �Z$d!d"�Z%d#d$�Z&d%d&�Z'd'd(�Z(zddl)Z)Wne*y�d)Z+Ynwd*Z+Gd+d,�d,�Z,e+r�Gd-d.�d.e,�Z-e�.d.�d/Z/Gd0d1�d1e,�Z0e1d2k�r)d3d4�Z2e2d5�Z3e2d6��4d7�Z5e6d8�d9Z7	ej8�9�Z:e:�sne7e:Z7q�e6d;e;e7��e,d<�Z<e<�=d:�e<�>e3e5e7�e<�?�dSdS)=�N)�body_encode)
�
SMTPException�SMTPNotSupportedError�SMTPServerDisconnected�SMTPResponseException�SMTPSenderRefused�SMTPRecipientsRefused�
SMTPDataError�SMTPConnectError�
SMTPHeloError�SMTPAuthenticationError�	quoteaddr�	quotedata�SMTP�i��
s
i �z	auth=(.*)c@�eZdZdS)rN��__name__�
__module__�__qualname__�rr�./opt/alt/python310/lib64/python3.10/smtplib.pyrH�rc@r)rNrrrrrrKrrc@r)rNrrrrrrRrrc@�eZdZ	dd�ZdS)rcCs||_||_||f|_dS�N)�	smtp_code�
smtp_error�args)�self�code�msgrrr�__init__cszSMTPResponseException.__init__N�rrrr#rrrrrZsrc@r)rcCs"||_||_||_|||f|_dSr)rr�senderr)r r!r"r%rrrr#oszSMTPSenderRefused.__init__Nr$rrrrrhsrc@r)rcCs||_|f|_dSr)�
recipientsr)r r&rrrr#}szSMTPRecipientsRefused.__init__Nr$rrrrrusrc@r)r	Nrrrrrr	�rr	c@r)r
Nrrrrrr
�rr
c@r)rNrrrrrr�rrc@r)rNrrrrrr�rrcCs@	tj�|�\}}||fdkr|���d�r|Sd|Sd|S)N��r(�<z<%s>)�email�utils�	parseaddr�strip�
startswith�Z
addrstringZdisplayname�addrrrrr
�sr
cCs$tj�|�\}}||fdkr|S|S)Nr')r*r+r,r/rrr�
_addr_only�sr1c	Cs	t�ddt�dt|��S)Nz(?m)^\.z..�(?:\r\n|\n|\r(?!\n))��re�sub�CRLF��datarrrr�s�rcCst�dd|�S)Ns(?m)^\.s..)r4r5)Zbindatarrr�_quote_periods��r9cCst�dt|�S)Nr2r3r7rrr�	_fix_eols�r:r;FTc@s�eZdZ	dZdZdZdZdZdZdZ	e
Zdddej
dfdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZdNdd�Zdd�ZdOdd�Zdd�ZdOdd�ZdOdd�ZdOdd �Zd!d"�ZdOd#d$�Zd%d&�Zd'd(�Zd)d*�ZdPd,d-�Z dPd.d/�Z!d0d1�Z"d2d3�Z#e#Z$d4d5�Z%d6d7�Z&d8d9�d:d;�Z'dQd<d=�Z(dQd>d?�Z)dQd@dA�Z*d8d9�dBdC�Z+dRdDdE�Z,	+	+dSdFdG�Z-		+dTdHdI�Z.dJdK�Z/dLdM�Z0dS)UrrN�ehloFr(c
Cs�	||_||_i|_d|_||_d|_|r*|�||�\}}|dkr*|��t||��|dur3||_	dSt
��}d|vr@||_	dSd}	z	t
�t
�
��}	Wn
t
jyUYnwd|	|_	dS)N�asciir���.z	127.0.0.1z[%s])�_host�timeout�esmtp_features�command_encoding�source_address�_auth_challenge_count�connect�closer
�local_hostname�socketZgetfqdnZ
gethostbynameZgethostnameZgaierror)
r �host�portrHrArDr!r"Zfqdnr0rrrr#�s0


�z
SMTP.__init__cCs|Srr�r rrr�	__enter__szSMTP.__enter__cGs`z*z|�d�\}}|dkrt||��Wn	tyYnwW|��dSW|��dS|��w)NZQUIT��)�docmdrrrG)r rr!�messagerrr�__exit__s
����z
SMTP.__exit__cCs	||_dSr)�
debuglevel)r rRrrr�set_debuglevel"s
zSMTP.set_debuglevelcGsD|jdkrttj����g|�Rdtji�dSt|dtji�dS)N��file)rR�print�datetimeZnow�time�sys�stderr�r rrrr�_print_debug+s
&zSMTP._print_debugcCsF|dur
|s
td��|jdkr|�d||f|j�t�||f||j�S)N�0Non-blocking socket (timeout=0) is not supportedrzconnect: to)�
ValueErrorrRr\rDrIZcreate_connection)r rJrKrArrr�_get_socket1s
�zSMTP._get_socket�	localhostcCs�	|r||_|s<|�d�|�d�kr<|�d�}|dkr<|d|�||dd�}}zt|�}Wnty;td��w|sA|j}t�d|||�|�	|||j
�|_d|_|�
�\}}|jdkrh|�dt|��||fS)N�:rrTznonnumeric portzsmtplib.connect�connect:)rD�find�rfind�intr^�OSError�default_portrY�auditr_rA�sockrU�getreplyrRr\�repr)r rJrKrD�ir!r"rrrrF;s*
�
zSMTP.connectcCs�	|jdkr|�dt|��|jr<t|t�r|�|j�}t�	d||�z	|j�
|�WdSty;|��t
d��wt
d��)Nrzsend:zsmtplib.send�Server not connectedzplease run connect() first)rRr\rkri�
isinstance�str�encoderCrYrhZsendallrfrGr)r �srrr�send\s

�z	SMTP.sendcCsf	|dkr|}n|�d|��}d|vsd|vr(|�dd��dd�}td|����|�|�t���dS)Nr(� �
�
z\nz\rz=command and arguments contain prohibited newline characters: )�replacer^rrr6)r �cmdrrqrrr�putcmdos�zSMTP.putcmdc
Cs<	g}|jdur|j�d�|_	z
|j�td�}Wnty2}z|��tdt|���d}~ww|s=|��td��|j	dkrJ|�
dt|��t|�tkrY|��t
dd��|�|d	d��d
��|dd�}zt|�}Wnty|d}Ynw|dd	�d
kr�nqd�|�}|j	dkr�|�
d||f�||fS)N�rbrTz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:i�zLine too long.�s 	
�����-�
zreply: retcode (%s); Msg: %a)rUriZmakefile�readline�_MAXLINErfrGrrorRr\rk�lenr�appendr-rer^�join)r �resp�line�er!Zerrcode�errmsgrrrrj|sJ
���

��

z
SMTP.getreplycCs	|�||�|��Sr�rxrj)r rwrrrrrO�sz
SMTP.docmdcCs.	|�d|p|j�|��\}}||_||fS)N�helo)rxrHrj�	helo_resp)r �namer!r"rrrr��s
z	SMTP.heloc
Cs.	i|_|�|j|p|j�|��\}}|dkr&t|�dkr&|��td��||_|dkr1||fSd|_	|j�
d��d�}|d=|D]P}t�
|�}|r_|j�dd	�d
|�d�d|jd<qBt�
d|�}|r�|�d���}|j|�d�d���}	|dkr�|j�|d	�d
|	|j|<qB|	|j|<qB||fS)
Nr|rrm�Tzlatin-1ru�authr(rsz((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?�feature)rBrx�ehlo_msgrHrjr�rGr�	ehlo_resp�
does_esmtp�decode�split�
OLDSTYLE_AUTH�match�get�groupsr4�group�lower�string�endr-)
r r�r!r"r��eachZ
auth_match�mr��paramsrrrr<�sF
�
���
�z	SMTP.ehlocCs	|��|jvSr)r�rB)r �optrrr�has_extn�sz
SMTP.has_extncCs	|�d|�|��dS)N�helprTr�r[rrrr��sz	SMTP.helpcCs	d|_|�d�S)Nr=�rset)rCrOrLrrrr��s
z	SMTP.rsetcCs&	z|��WdStyYdSwr)r�rrLrrr�_rset�s�z
SMTP._rsetcCs	|�d�S)N�noop)rOrLrrrr�s
z	SMTP.nooprcCsj	d}|r%|jr%tdd�|D��r|�d�rd|_ntd��dd�|�}|�dd	t|�|f�|��S)
Nr(css�|]	}|��dkVqdS)�smtputf8N)r�)�.0�xrrr�	<genexpr>s�zSMTP.mail.<locals>.<genexpr>r�zutf-8z SMTPUTF8 not supported by serverrs�mailz	FROM:%s%s)	r��anyr�rCrr�rxr
rj)r r%�options�
optionlistrrrr�s

�z	SMTP.mailcCs>	d}|r|jrdd�|�}|�ddt|�|f�|��S)Nr(rs�rcptzTO:%s%s)r�r�rxr
rj)r Zrecipr�r�rrrr�$s
z	SMTP.rcptcCs�	|�d�|��\}}|jdkr|�d||f�|dkr"t||��t|t�r.t|��d�}t	|�}|dd�t
kr>|t
}|dt
}|�|�|��\}}|jdkr\|�d||f�||fS)Nr8rzdata:ibr=����.)rxrjrRr\r	rnror;rpr9�bCRLFrr)r r"r!�repl�qrrrr8,s$
	




z	SMTP.datacC�	|�dt|��|��S)N�vrfy�rxr1rj�r Zaddressrrr�verifyI�zSMTP.verifycCr�)N�expnr�r�rrrr�Pr�z	SMTP.expncCsp	|jdur0|jdur2d|��dkrdks4n|��\}}d|kr*dks6nt||��dSdSdSdS)N��ri+)r�r�r<r�r)r r!r�rrr�ehlo_or_helo_if_neededWs

�zSMTP.ehlo_or_helo_if_neededT��initial_response_okc	Cs�	|��}|r
|�nd}|dur)t|�d�dd�}|�d|d|�\}}d|_n|�d|�\}}d|_|dkri|jd7_t�|�}t||��d�dd�}|�|�\}}|jtkretd	t	||f���|dks8|d
vrq||fSt
||��)Nr=r()ZeolZAUTHrsrTriNz4Server AUTH mechanism infinite loop. Last response: ���i�)�upper�
encode_base64rprOrE�base64Zdecodebytes�
_MAXCHALLENGErrkr)	r Z	mechanismZ
authobjectr�Zinitial_responseZresponser!r��	challengerrrr�hs4
�

���
z	SMTP.authcCs2	|durdS|jdt�|j�d�|d���S)Nrsr=Zmd5)�user�hmacZHMAC�passwordrpZ	hexdigest�r r�rrr�
auth_cram_md5�s��zSMTP.auth_cram_md5cCs	d|j|jfS)Nz%s%s)r�r�r�rrr�
auth_plain�szSMTP.auth_plaincCs 	|dus
|jdkr
|jS|jS)N�)rEr�r�r�rrr�
auth_login�szSMTP.auth_logincs�	|��|�d�std��|jd���gd�}�fdd�|D�}|s(td��|||_|_|D]:}d|���	dd	�}z|j
|t||�|d
�\}}	|dvrV||	fWSWq1tyk}
z|
}WYd}
~
q1d}
~
ww|�)Nr�z,SMTP AUTH extension not supported by server.)zCRAM-MD5ZPLAINZLOGINcsg|]}|�vr|�qSrr)r�r��Zadvertised_authlistrr�
<listcomp>�s�zSMTP.login.<locals>.<listcomp>z(No suitable authentication method found.Zauth_�-�_r�r�)
r�r�rrBr�rr�r�r�rvr��getattrr)r r�r�r�Zpreferred_authsZauthlistZ
authmethodZmethod_namer!r�r�Zlast_exceptionrr�r�login�s6
�

����z
SMTP.logincCs�	|��|�d�std��|�d�\}}|dkrrtstd��|dur+|dur+td��|dur7|dur7td��|dus?|durJddl}|�d	t	d
�|durUt
j||d�}|j|j
|jd�|_
d|_d|_d|_i|_d
|_||fSt||��)N�starttlsz+STARTTLS extension not supported by server.ZSTARTTLSr>z&No SSL support included in this Python�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�Zserver_hostnameF)r�r�rrO�	_have_ssl�RuntimeErrorr^�warnings�warn�DeprecationWarning�ssl�_create_stdlib_context�wrap_socketrir@rUr�r�rBr�r)r r�r��contextr�Zreplyr�rrrr��sB
����
�z
SMTP.starttlscCsZ	|��g}t|t�rt|��d�}|jr.|�d�r$|�dt|��|D]}|�|�q&|�	||�\}}	|dkrM|dkrC|�
�n|��t||	|��i}
t|t�rW|g}|D]$}|�
||�\}}	|dkrq|dkrq||	f|
|<|dkr}|�
�t|
��qYt|
�t|�kr�|��t|
��|�|�\}}	|dkr�|dkr�|�
�n|��t||	��|
S)Nr=�sizezsize=%dr�i��)r�rnror;rpr�r�r�r�r�rGr�rr�rr8r	)r �	from_addr�to_addrsr"�mail_options�rcpt_optionsZ
esmtp_optsZoptionr!r�Zsenderrsr�rrr�sendmail(sJ>



�

z
SMTP.sendmailcCs�	|��|�d�}|durd}n
t|�dkrd}ntd��|dur?|d|vr.||dn||d}tj�|g�dd}|durdd	d
�||d||d||d
fD�}dd
�tj�|�D�}t�|�}	|	d=|	d=d}
z
d�|g|���	d�Wnt
y�|�d�s�td��d}
Ynwt
���2}|
r�tjj||jjdd�d�}g|�d�d�R}ntj�|�}|j|	dd�|��}
Wd�n1s�wY|�|||
||�S)NzResent-Dater(rTzResent-z0message has more than one 'Resent-' header blockZSender�FromrcSsg|]}|dur|�qSrr)r��frrrr��s�z%SMTP.send_message.<locals>.<listcomp>�ToZBccZCccSsg|]}|d�qS)rTr)r��arrrr��sz
Resent-BccFr=r�z�One or more source or delivery addresses require internationalized email support, but the server does not advertise the required SMTPUTF8 capabilityT)�utf8)�policyZSMTPUTF8z
BODY=8BITMIMEr)�linesep)r�Zget_allr�r^r*r+Zgetaddresses�copyr�rp�UnicodeEncodeErrorr�r�io�BytesIO�	generatorZBytesGeneratorr�ZcloneZflatten�getvaluer�)r r"r�r�r�r�ZresentZ
header_prefixZaddr_fieldsZmsg_copyZ
internationalZbytesmsg�gZflatmsgrrr�send_message�s\
�
�

�

��
�
�	�zSMTP.send_messagecCsZ	z|j}d|_|r|��W|j}d|_|r|��dSdS|j}d|_|r,|��wwr)rUrGri)r rUrirrrrG�s"���
�z
SMTP.closecCs0	|�d�}d|_|_i|_d|_|��|S)N�quitF)rOr�r�rBr�rG)r �resrrrr��s
z	SMTP.quit�r`rN)r()rr)NNN)rr)NNrr)1rrrrRrirUr�r�r�r��	SMTP_PORTrgrI�_GLOBAL_DEFAULT_TIMEOUTr#rMrQrSr\r_rFrrrxrjrOr�r<r�r�r�r�r�r�r�r8r�r�r�r�r�r�r�r�r�r�r�r�rGr�rrrrr�sh
�0
	

!

1


3



0
	

B8
�h
�M
rcs>eZdZ	eZdddddejddfdd�Z�fdd�Z�Z	S)�SMTP_SSLr(rNc	
Cs�|dur|durtd��|dur|durtd��|dus |dur+ddl}	|	�dtd�||_||_|dur<tj||d�}||_t	�
||||||�dS)Nr�r�rr�r�r�)r^r�r�r�r�r�r�r�r�rr#)
r rJrKrHr�r�rArDr�r�rrrr#s&���zSMTP_SSL.__init__cs@|jdkr
|�d||f�t��|||�}|jj||jd�}|S)Nrrbr�)rRr\�superr_r�r�r@)r rJrKrAZ
new_socket��	__class__rrr_s
�zSMTP_SSL._get_socket)
rrr�
SMTP_SSL_PORTrgrIr�r#r_�
__classcell__rrrrr��s

�r�i�cs>eZdZ	dZdeddejf�fdd�	Zd
�fdd	�	Z�Z	S)�LMTPZlhlor(Ncs	t�j|||||d�dS)N)rHrDrA)rr#)r rJrKrHrDrArrrr#<s
�z
LMTP.__init__r`rcs�	|ddkrt�j|||d�S|jdur|jstd��z!t�tjtj�|_|jtjur3|j�	|j�d|_
|j�|�Wnty[|jdkrO|�
d|�|jrW|j��d|_�w|��\}}|jdkrm|�
d|�||fS)Nr�/)rDr]z
connect fail:rb)rrFrAr^rIZAF_UNIXZSOCK_STREAMrir�Z
settimeoutrUrfrRr\rGrj)r rJrKrDr!r"rrrrFBs.

�
zLMTP.connectr�)
rrrr��	LMTP_PORTrIr�r#rFrrrrrr,s
�r�__main__cCs(tj�|d�tj��tj����S)Nz: )rY�stdout�write�flush�stdinrr-)�promptrrrr
as
r
r�r��,zEnter message, end with ^D:r(rTzMessage length is %dr`)@rIr�r4Zemail.utilsr*Z
email.messageZemail.generatorr�r�r�rWrYZemail.base64mimerr��__all__r�rr6r�r�r��compile�Ir�rfrrrrrrr	r
rrr
r1rr9r;r��ImportErrorr�rr�r�rrrr
Zfromaddrr�ZtoaddrsrVr"rrr�r�ZserverrSr�r�rrrr�<module>s�)


	�<
/
4
�
�