
    =Ogi                     (   	 d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlmZ g dZdZdZdZdZdZd	Z ej        d
ej                  Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z  G d de          Z! G d de          Z" G d de          Z#d Z$d  Z%d! Z&d" Z'd# Z(	 d dl)Z)d$Z*n# e+$ r d%Z*Y nw xY w G d& d'          Z,e*r# G d( d)e,          Z-e.                    d)           d*Z/ G d+ d,e,          Z0e1d-k    rd. Z2 e2d/          Z3 e2d0          4                    d1          Z5 e6d2           d3Z7	 ej8        9                                Z:e:sne7e:z   Z7" e6d5 e;e7          z              e,d6          Z<e<=                    d4           e<>                    e3e5e7           e<?                                 dS dS )7    N)body_encode)SMTPExceptionSMTPNotSupportedErrorSMTPServerDisconnectedSMTPResponseExceptionSMTPSenderRefusedSMTPRecipientsRefusedSMTPDataErrorSMTPConnectErrorSMTPHeloErrorSMTPAuthenticationError	quoteaddr	quotedataSMTP   i  
s   
i       z	auth=(.*)c                       e Zd ZdS )r   N__name__
__module____qualname__      /usr/lib64/python3.11/smtplib.pyr   r   H   s        >>r   r   c                       e Zd ZdS )r   Nr   r   r   r   r   r   K            r   r   c                       e Zd ZdS )r   Nr   r   r   r   r   r   R   s         r   r   c                       e Zd Z	 d ZdS )r   c                 4    || _         || _        ||f| _        d S N)	smtp_code
smtp_errorargs)selfcodemsgs      r   __init__zSMTPResponseException.__init__c   s    3K			r   Nr   r   r   r(   r   r   r   r   r   Z   s(                 r   r   c                       e Zd Z	 d ZdS )r   c                 D    || _         || _        || _        |||f| _        d S r!   )r"   r#   senderr$   )r%   r&   r'   r,   s       r   r(   zSMTPSenderRefused.__init__o   s)    3'			r   Nr)   r   r   r   r   r   h   s(        ( ( ( ( (r   r   c                       e Zd Z	 d ZdS )r	   c                 $    || _         |f| _        d S r!   )
recipientsr$   )r%   r/   s     r   r(   zSMTPRecipientsRefused.__init__}   s    $M			r   Nr)   r   r   r   r	   r	   u   s(        " " " " "r   r	   c                       e Zd ZdS )r
   Nr   r   r   r   r
   r
      s        11r   r
   c                       e Zd ZdS )r   Nr   r   r   r   r   r      s        00r   r   c                       e Zd ZdS )r   Nr   r   r   r   r   r      s        ,,r   r   c                       e Zd ZdS )r   Nr   r   r   r   r   r      r   r   r   c                     	 t           j                            |           \  }}||fdk    r.|                                                     d          r| S d| z  S d|z  S )N r6   <z<%s>)emailutils	parseaddrstrip
startswith
addrstringdisplaynameaddrs      r   r   r      sp     --j99KTh&&((-- 	
""D=r   c                 ^    t           j                            |           \  }}||fdk    r| S |S )Nr5   )r8   r9   r:   r=   s      r   
_addr_onlyrB      s7    --j99KTh&&Kr   c           	      b    	 t          j        ddt          j        dt          |                     S )Nz(?m)^\.z..(?:\r\n|\n|\r(?!\n))resubCRLFdatas    r   r   r      s3    
 6*d
&d335 5 5r   c                 .    t          j        dd|           S )Ns   (?m)^\.s   ..)rF   rG   )bindatas    r   _quote_periodsrM      s    6+ug...r   c                 8    t          j        dt          |           S )NrD   rE   rI   s    r   	_fix_eolsrO      s    F*D$777r   TFc                   F   e Zd Z	 dZdZdZdZdZdZdZ	e
Zdddej        dfdZd Zd Zd	 Zd
 Zd Zd,dZd Zd-dZd Zd-dZd-dZd-dZd Zd-dZd Zd Zd Zd.dZ d.dZ!d Z"d Z#e#Z$d Z%d Z&d d!d"Z'd/d#Z(d/d$Z)d/d%Z*d d!d&Z+d0d'Z,	 	 d1d(Z-	 	 d2d)Z.d* Z/d+ Z0dS )3r   r   NehloFr6   c                    	 || _         || _        i | _        d| _        || _        d| _        |rC|                     ||          \  }}|dk    r$|                                  t          ||          |	|| _	        d S t          j                    }d|v r	|| _	        d S d}		 t          j        t          j                              }	n# t          j        $ r Y nw xY wd|	z  | _	        d S )Nasciir      .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^   rW   rZ   r&   r'   fqdnr@   s
             r   r(   zSMTP.__init__   s   	 
  ',%&" 	2,,tT22KT3s{{

&tS111%"0D
 >##Dd{{&*### #!/0B0D0DEEDD   D&,tm###s   %C CCc                     | S r!   r   r%   s    r   	__enter__zSMTP.__enter__  s    r   c                     	 |                      d          \  }}|dk    rt          ||          n# t          $ r Y nw xY w|                                  d S # |                                  w xY w)NQUIT   )docmdr   r   r]   )r%   r$   r&   messages       r   __exit__zSMTP.__exit__  s    	 JJv..MD's{{+D'::: % 	 	 	D	 JJLLLLLDJJLLLLs!   .1 A 
>A >A A-c                     	 || _         d S r!   )
debuglevel)r%   rq   s     r   set_debuglevelzSMTP.set_debuglevel"  s    	 %r   c                     | j         dk    rJt          t          j                                                                        g|R dt
          j        i d S t          |dt
          j        i d S )N   file)rq   printdatetimenowtimesysstderrr%   r$   s     r   _print_debugzSMTP._print_debug+  sk    ?Q(#''))..00I4IIIcjIIIII4)cj)))))r   c                     ||st          d          | j        dk    r|                     d||f| j                   t	          j        ||f|| j                  S )N0Non-blocking socket (timeout=0) is not supportedr   zconnect: to)
ValueErrorrq   r}   rZ   r_   create_connection)r%   rd   re   rW   s       r   _get_socketzSMTP._get_socket1  sm     wOPPP?QmdD\4;NOOO'tg(,(;= = 	=r   	localhostc                 T   	 |r|| _         |s|                    d          |                    d          k    r`|                    d          }|dk    rE|d |         ||dz   d          }}	 t          |          }n# t          $ r t          d          w xY w|s| j        }t          j        d| ||           | 	                    ||| j
                  | _        d | _        |                                 \  }}| j        dk    r#|                     dt!          |                     ||fS )N:r   rt   znonnumeric portzsmtplib.connectconnect:)rZ   findrfindintr   OSErrordefault_portrz   auditr   rW   sockru   getreplyrq   r}   repr)r%   rd   re   rZ   ir&   r'   s          r   r\   zSMTP.connect;  s=   		  	1"0D 	534::c??::

3AAvv!"1"XtAEFF|d5t99DD! 5 5 5!"34445 	%$D	#T4666$$T4>>		mmoos?Qj$s))444c{s   ,A< <Bc                    	 | j         dk    r#|                     dt          |                     | j        rt	          |t
                    r|                    | j                  }t          j	        d| |           	 | j        
                    |           d S # t          $ r$ |                                  t          d          w xY wt          d          )Nr   zsend:zsmtplib.sendServer not connectedzplease run connect() first)rq   r}   r   r   
isinstancestrencoderY   rz   r   sendallr   r]   r   )r%   ss     r   sendz	SMTP.send\  s    %?QgtAww///9 	G!S!! 4 HHT233IndA...E	!!!$$$$$ E E E

,-CDDDE ))EFFFs   =B .Cc                     	 |dk    r|}n| d| }d|v sd|v r<|                     dd                               dd          }t          d|           |                     | t                      d S )Nr6    
z\nz\rz=command and arguments contain prohibited newline characters: )replacer   r   rH   )r%   cmdr$   r   s       r   putcmdzSMTP.putcmdo  s    +2::AAA199				$&&..tU;;ASPQSS   			Q,,,r   c                    	 g }| j         | j                            d          | _         	 	 | j                             t          dz             }nE# t
          $ r8}|                                  t          dt          |          z             d }~ww xY w|s#|                                  t          d          | j	        dk    r#| 
                    dt          |                     t          |          t          k    r$|                                  t          dd          |                    |d	d                              d
                     |d d         }	 t!          |          }n# t"          $ r d}Y nw xY w|dd	         dk    rnfd                    |          }| j	        dk    r| 
                    d|d|           ||fS )Nrbrt   z Connection unexpectedly closed: zConnection unexpectedly closedr   zreply:i  zLine too long.   s    	
      -   
zreply: retcode (z); Msg: )ru   r   makefilereadline_MAXLINEr   r]   r   r   rq   r}   r   lenr   appendr;   r   r   join)r%   resplineer&   errcodeerrmsgs          r   r   zSMTP.getreply|  s   	 9	**400DI	7y))(Q,77 7 7 7

,-O/21vv.6 7 7 77  O

,-MNNN""!!(DJJ7774yy8##

+C1ABBBKKQRRz223338Dd))    AaCyD  5	8 D!!?QPQQQs)   "A 
B3BBE. .E=<E=c                 X    	 |                      ||           |                                 S r!   r   r   )r%   r   r$   s      r   rm   z
SMTP.docmd  s'    ;C}}r   c                     	 |                      d|p| j                   |                                 \  }}|| _        ||fS )Nhelo)r   r^   r   	helo_resp)r%   namer&   r'   s       r   r   z	SMTP.helo  sG    	 	FD7D$7888mmoosc{r   c                    	 i | _         |                     | j        |p| j                   |                                 \  }}|dk    r6t          |          dk    r#|                                  t          d          || _        |dk    r||fS d| _	        | j        
                    d                              d          }|d= |D ]}t                              |          }|rC| j                             dd	          d
z   |                    d          d         z   | j         d<   bt!          j        d|          }|r|                    d                                          }|j        |                    d          d                                          }	|dk    r+| j                             |d	          d
z   |	z   | j         |<   |	| j         |<   ||fS )Nr   r   r      Tzlatin-1r   authr6   r   z((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?feature)rX   r   ehlo_msgr^   r   r   r]   r   	ehlo_resp
does_esmtpdecodesplitOLDSTYLE_AUTHmatchgetgroupsrF   grouplowerstringendr;   )
r%   r   r&   r'   r   each
auth_matchmr   paramss
             r   rQ   z	SMTP.ehlo  s   	 !DM4#>4+>???mmoos 2::#c((a--JJLLL()?@@@3;;#; ~$$Y//55d;;G 	: 	:D ',,T22J .2.A.E.Efb.Q.Q/ * 1 1! 4 4Q 7/8#F+ DdKKA :''),,2244!%%	"2"2"3"34::<<f$$373F3J3J7TV3W3W!4"$*4+D'00 4:D'0c{r   c                 :    	 |                                 | j        v S r!   )r   rX   )r%   opts     r   has_extnzSMTP.has_extn  s    Eyy{{d111r   c                 d    	 |                      d|           |                                 d         S )Nhelprt   r   r|   s     r   r   z	SMTP.help  s.    	*FD!!!}}q!!r   c                 <    	 d| _         |                     d          S )NrS   rset)rY   rm   rh   s    r   r   z	SMTP.rset  s    4 'zz&!!!r   c                 T    	 	 |                                   d S # t          $ r Y d S w xY wr!   )r   r   rh   s    r   _rsetz
SMTP._rset  s?    		IIKKKKK% 	 	 	DD	s    
''c                 .    	 |                      d          S )Nnoop)rm   rh   s    r   r   z	SMTP.noop  s    ;zz&!!!r   r   c                 L   	 d}|rd| j         r]t          d |D                       r,|                     d          rd| _        nt	          d          dd                    |          z   }|                     ddt          |          |           |                                 S )	Nr6   c              3   F   K   | ]}|                                 d k    V  dS )smtputf8N)r   ).0xs     r   	<genexpr>zSMTP.mail.<locals>.<genexpr>  s/      ::Q17799j(::::::r   r   zutf-8z SMTPUTF8 not supported by serverr   mailzFROM:)	r   anyr   rY   r   r   r   r   r   )r%   r,   options
optionlists       r   r   z	SMTP.mail  s    	 
 	1t 	1::'::::: <==,, <,3D))/:< < <sxx000JFF9V+<+<+<jjIJJJ}}r   c                     	 d}|r| j         rdd                    |          z   }|                     ddt          |          |           |                                 S )Nr6   r   rcptzTO:)r   r   r   r   r   )r%   recipr   r   s       r   r   z	SMTP.rcpt$  sg    I
 	1t 	1sxx000JFF5)9)9)9::FGGG}}r   c                 T   	 |                      d           |                                 \  }}| j        dk    r|                     d||f           |dk    rt	          ||          t          |t                    r"t          |                              d          }t          |          }|dd          t          k    r
|t          z   }|dz   t          z   }|                     |           |                                 \  }}| j        dk    r|                     d||f           ||fS )NrJ   r   zdata:ib  rS      .)r   r   rq   r}   r
   r   r   rO   r   rM   bCRLFr   )r%   r'   r&   replqs        r   rJ   z	SMTP.data,  s   	 	F}}t?Qgd|4443;;d+++#s## 5nn++G44s##AvID5 AIIaLLL--//KT3""!!'D#;777#;r   c                 r    	 |                      dt          |                     |                                 S )Nvrfyr   rB   r   r%   addresss     r   verifyzSMTP.verifyI  s/    CFJw//000}}r   c                 r    	 |                      dt          |                     |                                 S )Nexpnr   r   s     r   r   z	SMTP.expnP  s/    <FJw//000}}r   c                     	 | j         d| j        _d|                                 d         cxk    rdk    s<n |                                 \  }}d|cxk    rdk    sn t	          ||          d S d S d S d S )N   r   i+  )r   r   rQ   r   r   )r%   r&   r   s      r   ehlo_or_helo_if_neededzSMTP.ehlo_or_helo_if_neededW  s    		 >!dn&<499;;q>0000S0000#yy{{tt****s****'d333	 "!&<&<00**r   Tinitial_response_okc                   	 |                                 }|r
 |            nd }|Kt          |                    d          d          }|                     d|dz   |z             \  }}d| _        n |                     d|          \  }}d| _        |dk    r| xj        dz  c_        t          j        |          }t           ||                              d          d          }|                     |          \  }}| j        t          k    r!t          d	t          ||f          z             |dk    |d
v r||fS t          ||          )NrS   r6   )eolAUTHr   rt   r   iN  z4Server AUTH mechanism infinite loop. Last response:    i  )upperencode_base64r   rm   r[   base64decodebytes_MAXCHALLENGEr   r   r   )	r%   	mechanism
authobjectr   initial_responseresponser&   r   	challenges	            r   r   z	SMTP.authh  sz   	* OO%%	,?IJJLLLT'$%5%<%<W%E%E2NNNH::fi#o.HIILT4)*D&&::fi88LT4)*D&ckk&&!+&&*400I$
9%%,,W552? ? ?H::h//LT4)M99#JD$<(()   ckk :$<%dD111r   c                     	 |d S | j         dz   t          j        | j                            d          |d                                          z   S )Nr   rS   md5)userhmacHMACpasswordr   	hexdigestr%   r  s     r   auth_cram_md5zSMTP.auth_cram_md5  sW    	( 4y3M  ))9e"= "==FY[[I 	Ir   c                 &    d| j         d| j        S )N )r	  r  r  s     r   
auth_plainzSMTP.auth_plain  s    	$!YYY66r   c                 :    	 || j         dk     r| j        S | j        S )N   )r[   r	  r  r  s     r   
auth_loginzSMTP.auth_login  s*    	$ :Q > >9= r   c                   	 |                                   |                     d          st          d          | j        d                                         g d}fd|D             }|st          d          ||c| _        | _        |D ]z}d|                                	                    dd          z   }	 | 
                    |t          | |          |	          \  }}	|d
v r||	fc S b# t          $ r}
|
}Y d }
~
sd }
~
ww xY w|)Nr   z,SMTP AUTH extension not supported by server.)zCRAM-MD5PLAINLOGINc                     g | ]}|v |	S r   r   )r   r   advertised_authlists     r   
<listcomp>zSMTP.login.<locals>.<listcomp>  s.     4 4 4T222 222r   z(No suitable authentication method found.auth_-_r   r   )r   r   r   rX   r   r   r	  r  r   r   r   getattrr   )r%   r	  r  r   preferred_authsauthlist
authmethodmethod_namer&   r   r   last_exceptionr  s               @r   loginz
SMTP.login  s   	6 	##%%%}}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$>$>sC$H$HHK	##yyk : :(;  )  =  =t
 :%% $<''' &* # # #!"# s   <0C00
D:DDc                 \   	 |                                   |                     d          st          d          |                     d          \  }}|dk    rt          st          d          ||t          d          ||t          d          || dd l}|                    d	t          d
           |t          j        ||          }|                    | j        | j                  | _        d | _        d | _        d | _        i | _        d| _        nt)          ||          ||fS )Nstarttlsz+STARTTLS extension not supported by server.STARTTLSrT   z&No SSL support included in this Python4context and keyfile arguments are mutually exclusive5context and certfile arguments are mutually exclusiver   Akeyfile and certfile are deprecated, use a custom context insteadr  certfilekeyfileserver_hostnameF)r   r   r   rm   	_have_sslRuntimeErrorr   warningswarnDeprecationWarningssl_create_stdlib_contextwrap_socketr   rV   ru   r   r   rX   r   r   )r%   r.  r-  contextr   replyr3  s          r   r'  zSMTP.starttls  s   	  	##%%%}}Z(( 	?'=? ? ?

:..u3;; M"#KLLL"w':  "- . . ."x';  "- . . ."h&: 78JAO O O4h=DF F F++DI<@J , H HDIDI
 "DN!DN"$D#DOO
 (e444e}r   c                 >   	 |                                   g }t          |t                    r"t          |                              d          }| j        rT|                     d          r%|                    dt          |          z             |D ]}|                    |           | 	                    ||          \  }}	|dk    r@|dk    r| 
                                 n|                                  t          ||	|          i }
t          |t                    r|g}|D ]W}|                     ||          \  }}	|dk    r|dk    r||	f|
|<   |dk    r#| 
                                 t          |
          Xt          |
          t          |          k    r#|                                  t          |
          |                     |          \  }}	|dk    r?|dk    r| 
                                 n|                                  t!          ||	          |
S )NrS   sizezsize=%dr   i     )r   r   r   rO   r   r   r   r   r   r   r]   r   r   r   r	   rJ   r
   )r%   	from_addrto_addrsr'   mail_optionsrcpt_options
esmtp_optsoptionr&   r   senderrsr   s               r   sendmailzSMTP.sendmail(  s   =	| 	##%%%
c3 	1C..''00C? 	*}}V$$ 8!!)c#hh"6777& * *!!&))))yyJ77t3;;s{{



#D$	:::h$$ 	" zH 	6 	6D99T<88LT4$#++"&s{{

+H555  x==CMM))JJLLL'111yy~~t3;;s{{



d+++r   c                    	 |                                   |                    d          }|d}n%t          |          dk    rd}nt          d          |I|dz   |v r||dz            n
||dz            }t          j                            |g          d         d         }|Sd	 ||d
z            ||dz            ||dz            fD             }d t          j                            |          D             }t          j        |          }	|	d= |	d= d}
	 d                    |g|          	                    d           n6# t          $ r) |                     d          st          d          d}
Y nw xY wt          j                    5 }|
rDt          j                            ||j                            d                    }g |ddR }nt          j                            |          }|                    |	d           |                                }d d d            n# 1 swxY w Y   |                     |||||          S )NzResent-Dater6   rt   zResent-z0message has more than one 'Resent-' header blockSenderFromr   c                     g | ]}||S r!   r   )r   fs     r   r  z%SMTP.send_message.<locals>.<listcomp>  s(     - - -  m  ,mmr   ToBccCcc                     g | ]
}|d          S )rt   r   )r   as     r   r  z%SMTP.send_message.<locals>.<listcomp>  s    LLL!LLLr   z
Resent-BccFrS   r   zOne 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   r8   r9   getaddressescopyr   r   UnicodeEncodeErrorr   r   ioBytesIO	generatorBytesGeneratorrQ  cloneflattengetvaluerE  )r%   r'   r>  r?  r@  rA  resentheader_prefixaddr_fieldsmsg_copyinternationalbytesmsggflatmsgs                 r   send_messagezSMTP.send_message  s   	: 	##%%%]++>MM[[A%MMOPPP  -x7C?? ]X566 #MF$: ;  00)==a@CI- -s=4+?'@'*=5+@'A'*=4+?'@'B - - -K MLek&>&>{&K&KLLLH9S>>UO\"	!GGY**++227;;;;! 	! 	! 	!==,, L+KL L L !MMM	! Z\\ 	*X =O22SZ%5%54%5%@%@ 3 B BKKzK?KKO228<<IIhI///''))G	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* }}Y'<)+ + 	+s%   +D> >0E10E1BH$$H(+H(c                     	 	 | j         }d | _         |r|                                 | j        }d | _        |r|                                 d S d S # | j        }d | _        |r|                                 w w xY wr!   )ru   r]   r   )r%   ru   r   s      r   r]   z
SMTP.close  s    6		9DDI 

9DDI 

  9DDI 

s   $A 'A6c                     	 |                      d          }d x| _        | _        i | _        d| _        |                                  |S )NquitF)rm   r   r   rX   r   r]   )r%   ress     r   rj  z	SMTP.quit  sE    )jj  *.. 


r   r   r   N)r6   )r   r!   )NNN)r   r   )NNr   r   )1r   r   r   rq   r   ru   r   r   r   r   	SMTP_PORTr   r_   _GLOBAL_DEFAULT_TIMEOUTr(   ri   ro   rr   r}   r   r\   r   r   r   rm   r   rQ   r   r   r   r   r   r   r   rJ   r   r   r   r   r   r  r  r  r%  r'  rE  rg  r]   rj  r   r   r   r   r      s       8 JDDIHIJLQt7 $.4 .4 .4 .4`    % % %* * *= = =   BG G G&       / / /b      1 1 1 1f2 2 2" " " "" " "

 
 
" " "   *     :  
 D  4 4 4" BF .2 .2 .2 .2 .2`I I I I7 7 7 7
! ! ! ! <@ @ @ @ @ @D6 6 6 6p ?A f f f fP :>35K+ K+ K+ K+Z      r   r   c                   F     e Zd Z	 eZdddddej        ddfdZ fdZ xZ	S )SMTP_SSLr6   r   Nc	                 2   ||t          d          ||t          d          || dd l}	|	                    dt          d           || _        || _        |t          j        ||          }|| _        t          
                    | |||||           d S )Nr)  r*  r   r+  r  r,  )r   r3  r4  r5  r.  r-  r6  r7  r9  r   r(   )
r%   rd   re   r^   r.  r-  rW   rZ   r9  r3  s
             r   r(   zSMTP_SSL.__init__  s     "w':  "- . . ."x';  "- . . ."h&: 78JAO O O"DL$DM4h=DF F F"DLMM$dNG(* * * * *r   c                     | j         dk    r|                     d||f           t                                          |||          }| j                            || j                  }|S )Nr   r   r/  )rq   r}   superr   r9  r8  rV   )r%   rd   re   rW   
new_socket	__class__s        r   r   zSMTP_SSL._get_socket  sp    ""!!*tTl;;;,,T4AAJ11*BF* 2 N NJr   )
r   r   r   SMTP_SSL_PORTr   r_   rn  r(   r   __classcell__ru  s   @r   rp  rp    so        	 % "4!D#;$($	* 	* 	* 	*.	 	 	 	 	 	 	 	 	r   rp  i  c                   F     e Zd Z	 dZdeddej        f fd	Zd fd	Z xZ	S )	LMTPlhlor6   Nc                 V    	 t                                          |||||           d S )N)r^   rZ   rW   )rs  r(   )r%   rd   re   r^   rZ   rW   ru  s         r   r(   zLMTP.__init__<  sA    (tN(6 	 	I 	I 	I 	I 	Ir   r   r   c                    	 |d         dk    r$t                                          |||          S | j        | j        st          d          	 t	          j        t          j        t          j                  | _        | j        t          j        ur| j        	                    | j                   d | _
        | j                            |           nW# t          $ rJ | j        dk    r|                     d|           | j        r| j                                         d | _         w xY w|                                 \  }}| j        dk    r|                     d|           ||fS )Nr   /)rZ   r   zconnect fail:r   )rs  r\   rW   r   r_   AF_UNIXSOCK_STREAMr   rn  
settimeoutru   r   rq   r}   r]   r   )r%   rd   re   rZ   r&   r'   ru  s         r   r\   zLMTP.connectB  sV   K7c>>77??4n?MMM<#DL#OPPP	fnf6HIIDI|6#AAA	$$T\222DIId#### 	 	 	""!!/4888y "	!!!DI	 mmoos?Qj#...c{s   BC AD'rl  )
r   r   r   r   	LMTP_PORTr_   rn  r(   r\   rw  rx  s   @r   rz  rz  ,  s|        4 HYt $f.LI I I I I I         r   rz  __main__c                     t           j                            | dz              t           j                                         t           j                                                                        S )Nz: )rz   stdoutwriteflushstdinr   r;   )prompts    r   r  r  a  sP    
$'''
y!!##))+++r   rH  rK  ,zEnter message, end with ^D:r6   rt   zMessage length is %dr   )@r_   rX  rF   email.utilsr8   email.messageemail.generatorr   r
  rV  rw   rz   email.base64mimer   r   __all__rm  rv  rH   r   r   r  compileIr   r   r   r   r   r   r   r	   r
   r   r   r   r   rB   r   rM   rO   r6  r1  ImportErrorr   rp  r   r  rz  r   r  fromaddrr   toaddrsrv   r'   r  r   r   r   serverrr   rE  rj  r   r   r   <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JJJ II    IIIt t t t t t t tl  1- - - - -4 - - -^ NN:
 	/ / / / /4 / / /h z, , ,
 vf~~HfTll  %%G	E
'(((
Cy!!## 	Dj	
 
E
 33s88
+,,,T+F
!
OOHgs+++
KKMMMMM) s   6C= =DD