Ë
    ojk ã                   ó
  — d 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
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZmZmZmZ dd
lmZ ddlmZmZ ddlm Z m!Z!m"Z# ddl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z6m7Z7 ddl8m9Z9m:Z:m;Z;m<Z= ddl>m?Z?m@Z@ ddlAmBZBmCZC ddlDmEZEmFZFmGZG ddlHmIZI g d¢ZJ eIj–                  «       r! ej˜                  «       j›                  d«      ZNn  ejž                  «       j›                  d«      ZNePj£                   eRdd«      «      ZSdDd„ZTd„ ZU eU«       ZVdd„ fd„ZWd„ ZXd\  ZYZZZ[dZ\ G d„ d«      Z] G d „ d!«      Z^ G d"„ d#e?j¾                  e@jÀ                  «      Za G d$„ d%ejÄ                  «      Zc G d&„ d'e?jÈ                  e@jÀ                  «      Ze G d(„ d)ee«      Zf G d*„ d+ea«      Zg G d,„ d-«      Zh G d.„ d/ehee«      Zi G d0„ d1ejÔ                  «      Zk G d2„ d3e#«      Z" ee9«       G d4„ d5«      «       Zl G d6„ d7ehef«      Zm G d8„ d9ek«      Zndd:eddd;d;fd<„ZoddlpZpdEd=„ZqdEd>„Zr G d?„ d@epjæ                  «      Zt G dA„ dBepjê                  «      ZvdC„ Zw epjð                  ew«       y)Fz/
Simple Mail Transfer Protocol implementation.
é    N)Ú	parseaddr)ÚBytesIO)ÚType)Úimplementer)Úcred)Úlongversion)ÚdeferÚerrorÚprotocolÚreactor)Ú	_idnaText)ÚISSLTransportÚITLSTransport)ÚCramMD5ClientAuthenticatorÚLOGINAuthenticatorÚLOGINCredentials)ÚAddressErrorÚAUTHDeclinedErrorÚAuthenticationErrorÚAUTHRequiredErrorÚEHLORequiredErrorÚESMTPClientErrorÚSMTPAddressErrorÚSMTPBadRcptÚSMTPBadSenderÚSMTPClientErrorÚSMTPConnectErrorÚSMTPDeliveryErrorÚ	SMTPErrorÚSMTPProtocolErrorÚSMTPServerErrorÚSMTPTimeoutErrorÚSMTPTLSErrorÚTLSRequiredError)ÚIClientAuthenticationÚIMessageDeliveryÚIMessageDeliveryFactoryÚIMessageSMTP)ÚbasicÚpolicies)ÚlogÚutil)Ú	iterbytesÚnativeStringÚnetworkString)Úplatform)0r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r"   ÚTLSErrorr$   r    r%   ÚIMessager&   r'   r   r   r   ÚPLAINAuthenticatorÚAddressÚUserÚsendmailÚSenderMixinÚESMTPÚESMTPClientÚESMTPSenderÚESMTPSenderFactoryÚSMTPÚ
SMTPClientÚSMTPFactoryÚ
SMTPSenderÚSMTPSenderFactoryÚidGeneratorÚ	messageidÚ	quoteaddrÚ
rfc822dateÚxtextStreamReaderÚxtextStreamWriterÚxtext_codecÚxtext_decodeÚxtext_encodeÚasciiéÈ   i,  c                 ó´  — | s+|rt        j                  «       } nt        j                  «       } |rl| d   rt         j                   }nt         j                   }t        t        |«      d«      \  }}|r|t        t        |«      |z  «      z  }t        |d«      \  }}nd\  }}t        dg d¢| d      | d   g d	¢| d
   d
z
     | d   | d   | d   | d   ||f	z  «      S )aà  
    Format an RFC-2822 compliant date string.

    @param timeinfo: (optional) A sequence as returned by C{time.localtime()}
        or C{time.gmtime()}. Default is now.
    @param local: (optional) Indicates if the supplied time is local or
        universal time, or if no time is given, whether now should be local or
        universal time. Default is local, as suggested (SHOULD) by rfc-2822.

    @returns: A L{bytes} representing the time and date in RFC-2822 format.
    é   i  é<   )r   r   z)%s, %02d %s %04d %02d:%02d:%02d %+03d%02d)ÚMonÚTueÚWedÚThuÚFriÚSatÚSuné   é   )ÚJanÚFebÚMarÚAprÚMayÚJunÚJulÚAugÚSepÚOctÚNovÚDecé   r   é   é   é   )	ÚtimeÚ	localtimeÚgmtimeÚaltzoneÚtimezoneÚdivmodÚabsÚintr/   )ÚtimeinfoÚlocalÚtzÚtzhrÚtzminÚtzsecs         ú3/usr/lib/python3/dist-packages/twisted/mail/smtp.pyrD   rD   „   sð   € ñ ÙÜ—~‘~Ó'‰Hä—{‘{“}ˆHÙØ�AŠ;ä—,‘,�‰Bä—-‘-�ˆBäœs 2›w¨Ó-‰ˆˆuÙØ”Cœ˜B› 2™Ó&Ñ&ˆDÜ  rÓ*‰ˆ‘à‰ˆˆuäØ3â=¸hÀq¹kÑJØ�Q‰Kòð �q‰k˜A‰oñð �Q‰KØ�Q‰KØ�Q‰KØ�Q‰KØØð-
ñ	
óð ó    c               #   ó$   K  — d} 	 | –— | dz  } Œ
­w)Nr   rd   © )Úis    rv   rA   rA   À   s!   è ø€ Ø	€AØ
ØŠØ	ˆQ‰ˆð ùs   ‚c                  ó    — t        t        «      S ©N)ÚnextÚ_genry   rw   rv   ú<lambda>r   Ê   s
   € ¤4¬£:€ rw   c           	      ó.  — t        j                  dt        j                  «       «      }t        j                  «       }t        j                  d«      }| €d} nd| z   } dj                  ||||  |«       t        j                  «       «      j                  «       S )zÁ
    Return a globally unique random string in RFC 2822 Message-ID format

    <datetime.pid.random@host.dom.ain>

    Optional uniq string will be added to strengthen uniqueness if given.
    z%Y%m%d%H%M%SiÿÿÿÚ ú.z<{}.{}.{}{}.{}@{}>)rh   Ústrftimerj   ÚosÚgetpidÚrandomÚ	randrangeÚformatÚDNSNAMEÚdecodeÚencode)ÚuniqÚNÚdatetimeÚpidÚrands        rv   rB   rB   Ê   sx   € ô �}‰}˜^¬T¯[©[«]Ó;€HÜ
�)‰)‹+€CÜ×Ñ˜IÓ&€DØ€|Ø‰à�T‰zˆà×&Ñ&Ø�#�t˜T¡1£3¬¯©Ó(8óç�fƒhðrw   c                 óü   — t        | t        «      rdt        | «      z   dz   S t        | t        «      r| j                  d«      } t	        | «      }|dk(  rdt        | «      z   dz   S d|d   j                  d«      z   dz   S )zq
    Turn an email address, possibly with realname part etc, into
    a form suitable for and SMTP envelope.
    ó   <ó   >rJ   ©NNrd   )Ú
isinstancer4   ÚbytesrŠ   r   r‹   )ÚaddrÚress     rv   rC   rC   ß   s|   € ô �$œÔ Ø”e˜D“kÑ! DÑ(Ð(ä�$œÔØ�{‰{˜7Ó#ˆä
�D‹/€Cà
ˆlÒà”e˜D“kÑ! DÑ(Ð(à�c˜!‘f—m‘m GÓ,Ñ,¨tÑ3Ð3rw   )ÚCOMMANDÚDATAÚAUTHs   [-A-Za-z0-9!\#$%&'*+/=?^_`{|}~]c                   óÐ   — e Zd ZdZ ej
                  dez   dz   ej                  «      Z ej
                  e«      Z	dd„Z
 ej
                  d«      Zd„ Zdefd	„Zdefd
„Zdefd„Zy)r4   aF  Parse and hold an RFC 2821 address.

    Source routes are stipped and ignored, UUCP-style bang-paths
    and %-style routing are not parsed.

    @type domain: C{bytes}
    @ivar domain: The domain within which this address resides.

    @type local: C{bytes}
    @ivar local: The local ("user") portion of this address.
    s    ( # A string of
                           (?:"[^"]*" # quoted string
                           |\\. # backslash-escaped characted
                           |sL    # atom character
                           )+|.) # or any single characterNc                 óø  — t        |t        «      r|j                  }t        |t        «      r |j                  j                  «       | _        y t        |t        «      st        |«      j                  d«      }|| _	        t        t        d | j                  j                  |«      «      «      }g }g }|rî|d   dk(  r|d   dk7  rt        d«      ‚|dd }nÊ|d   dk(  rE|dd  }|s-|r|d   d	k7  r|dd  }|r	|d   d	k7  rŒ|st        d
«      ‚|dd  }nŽ|rt        d«      ‚dg}n}t        |d   «      dk(  r<| j                   j#                  |d   «      s|d   dk7  rt        d|d   ›d||f›�«      ‚|s|j%                  |d   «       n|j%                  |d   «       |dd  }|rŒîdj'                  |«      | _        dj'                  |«      | _        | j(                  dk7  r | j*                  dk(  r|€t,        }|| _        y y y )NrJ   r   r’   éÿÿÿÿr“   zUnbalanced <>rd   ó   @ó   :zMalformed source routez
Too many @rw   ó   .zParse error at z of )r•   r5   Údestr4   Ú__dict__Úcopyr–   Ústrr‹   ÚaddrstrÚlistÚfilterÚtstringÚsplitr   ÚlenÚatomreÚmatchÚappendÚjoinrq   Údomainr‰   )Úselfr—   ÚdefaultDomainÚatlrq   r°   s         rv   Ú__init__zAddress.__init__  sþ  € Ü�dœDÔ!Ø—9‘9ˆDÜ�dœGÔ$Ø ŸM™M×.Ñ.Ó0ˆDŒMØÜ˜D¤%Ô(Ü�t“9×#Ñ# GÓ,ˆDàˆŒô ”6˜$ §¡× 2Ñ 2°4Ó 8Ó9Ó:ˆØˆØˆáØ�1‰v˜Š~Ø�r‘7˜d’?Ü& Ó7Ð7Ø˜!˜B�i‘Ø�Q‘˜4’Ø˜!˜"�g�Ùá # a¡&¨D¢.à! ! "˜g˜ñ  # a¡&¨D£.ñ Ü*Ð+CÓDÐDØ˜a˜b˜'‘CÙÜ& |Ó4Ð4ð "˜U‘FÜ�S˜‘V“ Ò!¨$¯+©+×*;Ñ*;¸CÀ¹FÔ*CÈÈAÉÐRVÊÜ" _°S¸±V°J¸dÀDÈ#À;À/Ð#RÓSÐSáØ—L‘L  Q¡Õ(à—M‘M # a¡&Ô)Ø˜!˜"�g�ò7 ð: —X‘X˜e“_ˆŒ
Ø—h‘h˜vÓ&ˆŒØ�:‰:˜Ò §¡°Ò!3ØÐ$Ü '�Ø'ˆD�Kð "4Ðrw   s   \\(.)c                 ó   — g }t        |t        «      st        |«      j                  d«      }t	        d| j
                  j                  |«      «      }|D ]h  }|d   dk(  r|d   dk(  r|j                  |dd «       Œ(d|v r,|j                  | j                  j                  d|«      «       ŒX|j                  |«       Œj d	j                  |«      S )
z6
        Remove RFC-2821 quotes from address.
        rJ   Nr   ó   "rž   rd   ú\s   \1rw   )r•   r–   r¥   r‹   r¨   r©   rª   r®   Ú	dequotebsÚsubr¯   )r±   r—   r˜   r³   Úts        rv   ÚdequotezAddress.dequoteJ  s·   € ð ˆä˜$¤Ô&Ü�t“9×#Ñ# GÓ,ˆDä�T˜4Ÿ<™<×-Ñ-¨dÓ3Ó4ˆàò 	ˆAØ�‰t�tŠ|  "¡¨¢Ø—
‘
˜1˜Q˜r˜7Õ#Ø˜‘Ø—
‘
˜4Ÿ>™>×-Ñ-¨f°aÓ8Õ9à—
‘
˜1•ð	ð �x‰x˜‹}Ðrw   Úreturnc                 ó@   — | j                  «       j                  d«      S ©NrJ   ©Ú	__bytes__rŠ   ©r±   s    rv   Ú__str__zAddress.__str___  ó   € Ø�~‰~Ó×&Ñ& wÓ/Ð/rw   c                 ó‚   — | j                   s| j                  r'dj                  | j                   | j                  f«      S y)NrŸ   rw   )rq   r°   r¯   rÁ   s    rv   rÀ   zAddress.__bytes__b  s.   € Ø�:Š:˜ŸšØ—9‘9˜dŸj™j¨$¯+©+Ð6Ó7Ð7àrw   c           	      óˆ   — dj                  | j                  | j                  j                  t	        t        | «      «      «      S )Nz	{}.{}({}))rˆ   Ú
__module__Ú	__class__Ú__name__Úreprr¥   rÁ   s    rv   Ú__repr__zAddress.__repr__h  s2   € Ø×!Ñ!Ø�O‰O˜TŸ^™^×4Ñ4´d¼3¸t»9³oó
ð 	
rw   r|   )rÈ   rÆ   Ú__qualname__Ú__doc__ÚreÚcompileÚatomÚXr©   r¬   r´   r¸   r»   r¥   rÂ   r–   rÀ   rÊ   ry   rw   rv   r4   r4   û   sŽ   „ ñ
ð ˆb�j‰jð	 ð ñ		ð
>ñ	>ð 	�‰ó	€Gð ˆR�Z‰Z˜Ó€Fó2(ðh �—
‘
˜9Ó%€Iòð*0˜ó 0ð˜5ó ð
˜#ô 
rw   r4   c                   ó4   — e Zd ZdZd„ Zd„ Zdefd„Zdefd„Z	y)r5   zu
    Hold information about and SMTP message recipient,
    including information on where the message came from
    c                 óÐ   — 	 |j                   }t        ||«      | _        || _        || _        t        |t        «      r|| _        y t        ||«      | _        y # t        $ r d }Y ŒVw xY wr|   )ÚhostÚAttributeErrorr4   r¢   Úhelor   r•   Úorig)r±   ÚdestinationrÕ   r   rÖ   rÓ   s         rv   r´   zUser.__init__t  sc   € ð	Ø—=‘=ˆDô ˜K¨Ó.ˆŒ	ØˆŒ	Ø ˆŒÜ�dœGÔ$ØˆD�Iä  dÓ+ˆD�Iøô ò 	ØŠDð	ús   ‚A ÁA%Á$A%c                 óL   — | j                   | j                  d| j                  dœS )z€
        Helper for pickle.

        protocol isn't picklabe, but we want User to be, so skip it in
        the pickle.
        N)r¢   rÕ   r   rÖ   )r¢   rÕ   rÖ   rÁ   s    rv   Ú__getstate__zUser.__getstate__�  s&   € ð —I‘IØ—I‘IØØ—I‘Iñ	
ð 	
rw   r¼   c                 ó@   — | j                  «       j                  d«      S r¾   r¿   rÁ   s    rv   rÂ   zUser.__str__�  rÃ   rw   c                 ó,   — t        | j                  «      S r|   )r–   r¢   rÁ   s    rv   rÀ   zUser.__bytes__’  s   € Ü�T—Y‘YÓÐrw   N)
rÈ   rÆ   rË   rÌ   r´   rÙ   r¥   rÂ   r–   rÀ   ry   rw   rv   r5   r5   n  s)   „ ñò
,ò
ð0˜ó 0ð ˜5ô  rw   r5   c                   óþ  — e Zd ZdZdZdZdZdZdZdZ	d*d„Z
ed„ «       Zej                  d„ «       Zd„ Zd	„ Zd
„ Zd+d„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zdez   dz   Z ej:                  dez   dz   ez   dz   ej<                  ej>                  z  «      Z  ej:                  dez   dz   ez   dz   ej<                  ej>                  z  «      Z!d„ Z"d,d„Z#d„ Z$d„ Z%d-d„Z&d„ Z'd „ Z(d!„ Z)d"„ Z*d#„ Z+d$„ Z,e,Z-d%„ Z.d&„ Z/d'„ Z0d(„ Z1d)„ Z2y).r<   zp
    SMTP server-side protocol.

    @ivar host: The hostname of this mail server.
    @type host: L{bytes}
    éX  NTc                 óv   — t         | _        d | _        d | _        g | _        || _        || _        t        | _        y r|   )	r™   ÚmodeÚ_fromÚ_heloÚ_toÚdeliveryÚdeliveryFactoryr‰   rÓ   )r±   rã   rä   s      rv   r´   zSMTP.__init__µ  s4   € ÜˆŒ	ØˆŒ
ØˆŒ
ØˆŒØ ˆŒØ.ˆÔÜˆ�	rw   c                 ó   — | j                   S r|   )Ú_hostrÁ   s    rv   rÓ   z	SMTP.host¾  s   € à�z‰zÐrw   c                 óf   — t        |t        «      st        |«      j                  d«      }|| _        y r¾   )r•   r–   r¥   r‹   ræ   )r±   ÚtoSets     rv   rÓ   z	SMTP.hostÂ  s'   € ä˜%¤Ô'Ü˜“J×%Ñ% gÓ.ˆEØˆ�
rw   c                 óz   — | j                   dz   }| j                  d|«       | j                  j                  «        y )Ns'    Timeout. Try talking faster next time!i¥  )rÓ   ÚsendCodeÚ	transportÚloseConnection)r±   Úmsgs     rv   ÚtimeoutConnectionzSMTP.timeoutConnectionÈ  s/   € Ø�i‰iÐDÑDˆØ�‰�c˜3ÔØ�‰×%Ñ%Õ'rw   c                 ó    — | j                   dz   S )Ns    NO UCE NO UBE NO RELAY PROBES)rÓ   rÁ   s    rv   ÚgreetingzSMTP.greetingÍ  s   € Ø�y‰yÐ<Ñ<Ð<rw   c                 ó  — | j                   j                  «       }	 |j                  }d |f| _        | j                  d| j                  «       «       | j                  | j                  «       y # t        $ r t	        |«      }Y Œ[w xY w©NéÜ   )
rë   ÚgetPeerrÓ   rÔ   r¥   rá   rê   rð   Ú
setTimeoutÚtimeout)r±   ÚpeerrÓ   s      rv   ÚconnectionMadezSMTP.connectionMadeÐ  sm   € à�~‰~×%Ñ%Ó'ˆð	Ø—9‘9ˆDð ˜D�\ˆŒ
Ø�‰�c˜4Ÿ=™=›?Ô+Ø�‰˜Ÿ™Õ%øô	 ò 	Ü�t“9ŠDð	ús   œA- Á-BÂBc                 óÜ   — |j                  «       }|dd }|dd D ]#  }| j                  t        d|fz  «      |z   «       Œ% | j                  t        d|fz  «      |xr |d   xs dz   «       y)z3
        Send an SMTP code with a message.
        rž   Nz%3.3d-z%3.3d r   rw   )Ú
splitlinesÚsendLiner/   )r±   ÚcodeÚmessageÚlinesÚlastlineÚlines         rv   rê   zSMTP.sendCodeÛ  s   € ð ×"Ñ"Ó$ˆØ˜˜�:ˆØ˜#˜2�Jò 	DˆDØ�M‰Mœ-¨°D°7Ñ(:Ó;¸dÑBÕCð	Dà�‰Ü˜( d WÑ,Ó-°Ò1I¸hÀq¹kÒ1PÈSÑQõ	
rw   c                 ó`   — | j                  «         t        | d| j                  z   «      |«      S )NÚstate_)ÚresetTimeoutÚgetattrrß   ©r±   r   s     rv   ÚlineReceivedzSMTP.lineReceivedç  s+   € Ø×ÑÔØ2Œw�t˜X¨¯	©	Ñ1Ó2°4Ó8Ð8rw   c                 óö   — |j                  «       }|j                  d d«      }|rE| j                  |d   «      xs | j                  }t	        |«      dk(  r ||d   «       y  |d«       y | j                  «        y )Nrd   r   rW   rw   )Ústriprª   ÚlookupMethodÚ
do_UNKNOWNr«   ÚsendSyntaxError)r±   r   ÚpartsÚmethods       rv   Ústate_COMMANDzSMTP.state_COMMANDë  si   € ð �z‰z‹|ˆà—
‘
˜4 Ó#ˆÙØ×&Ñ& u¨Q¡xÓ0ÒC°D·O±OˆFÜ�5‹z˜QŠÙ�u˜Q‘xÕ á�s•à× Ñ Õ"rw   c                 ó(   — | j                  dd«       y )Néô  s   Error: bad syntax©rê   rÁ   s    rv   r  zSMTP.sendSyntaxErrorû  s   € Ø�‰�cÐ/Õ0rw   c                 ót   — t        |t        «      st        |«      }t        | d|j	                  «       z   d«      S )zŸ

        @param command: The command to get from this class.
        @type command: L{str}
        @return: The function which executes this command.
        Údo_N)r•   r¥   r.   r  Úupper)r±   Úcommands     rv   r	  zSMTP.lookupMethodþ  s2   € ô ˜'¤3Ô'Ü" 7Ó+ˆGä�t˜U W§]¡]£_Ñ4°dÓ;Ð;rw   c                 ó¨   — | j                   t        u r.| j                  D ]  }|j                  «        Œ t        | _         | `| j                  dd«       y )Nr  s   Line too long)rß   rš   Ú_SMTP__messagesÚconnectionLostr™   rê   )r±   r   rý   s      rv   ÚlineLengthExceededzSMTP.lineLengthExceeded
  sH   € Ø�9‰9œÑØŸ?™?ò )�Ø×&Ñ&Õ(ð)äˆDŒIØ�Ø�‰�cÐ+Õ,rw   c                 ó(   — | j                  dd«       y )Nr  s   Command not implementedr  ©r±   Úrests     rv   r
  zSMTP.do_UNKNOWN  s   € Ø�‰�cÐ5Õ6rw   c                 ó@  — | j                   j                  «       }	 |j                  }t        |t        «      s|j                  d«      }||f| _        d | _	        g | _
        | j                  d| j                  dz   |z   dz   «       y # t        $ r t	        |«      }Y Œtw xY w)NÚidnaéú   ó    Hello s   , nice to meet you)rë   rô   rÓ   rÔ   r¥   r•   r–   r‹   rá   rà   râ   rê   )r±   r  r÷   rÓ   s       rv   Údo_HELOzSMTP.do_HELO  s‘   € Ø�~‰~×%Ñ%Ó'ˆð	Ø—9‘9ˆDô ˜$¤Ô&Ø—;‘;˜vÓ&ˆDà˜D�\ˆŒ
ØˆŒ
ØˆŒØ�‰�c˜4Ÿ9™9 zÑ1°DÑ8Ð;PÑPÕQøô ò 	Ü�t“9ŠDð	ús   œB ÂBÂBc                 ó\   — | j                  dd«       | j                  j                  «        y )NéÝ   s   See you later)rê   rë   rì   r  s     rv   Údo_QUITzSMTP.do_QUIT$  s!   € Ø�‰�cÐ+Ô,Ø�‰×%Ñ%Õ'rw   s   ("[^"]*"|\\.|s	   |[@.,:])+s>   \s*FROM:\s*(?P<path><> # Empty <>
                          |<s&   > # <addr>
                          |sq    # addr
                          )\s*(\s(?P<opts>.*))? # Optional WS + ESMTP options
                          $s   \s*TO:\s*(?P<path><c           	      ó  — | j                   r| j                  dd«       y g | _        | j                  j	                  |«      }|s| j                  dd«       y 	 t        |j                  d«      | j                  «      }t        j                  | j                  | j                  |«      }|j                  | j                   | j"                  «       y # t        $ r.}| j                  dt        t        |«      «      «       Y d }~y d }~ww xY w)Né÷  s#   Only one sender per message, pleaseéõ  ó   Syntax errorÚpathé)  )rà   rê   râ   Úmail_rer­   r4   ÚgrouprÓ   r   r/   r¥   r	   ÚmaybeDeferredÚvalidateFromrá   ÚaddCallbacksÚ_cbFromValidateÚ_ebFromValidate)r±   r  Úmr—   ÚeÚ	validateds         rv   Údo_MAILzSMTP.do_MAILD  sÏ   € Ø�:Š:Ø�M‰M˜#ÐEÔFØàˆŒØ�L‰L×Ñ˜tÓ$ˆÙØ�M‰M˜#˜Ô/Øð	Ü˜1Ÿ7™7 6›?¨D¯I©IÓ6ˆDô
 ×'Ñ'¨×(9Ñ(9¸4¿:¹:ÀtÓLˆ	Ø×Ñ˜t×3Ñ3°T×5IÑ5IÕJøô ò 	Ø�M‰M˜#œ}¬S°«VÓ4Ô5Üûð	ús   Á%C Ã	DÃ$DÄDc                 ó6   — || _         | j                  ||«       y r|   )rà   rê   )r±   Ú	fromEmailrü   rí   s       rv   r0  zSMTP._cbFromValidateX  s   € ØˆŒ
Ø�‰�d˜CÕ rw   c                 ó  — |j                  t        «      rj| j                  |j                  j                  dt        |j                  j                  «      z   dz   t        |j                  j                  «      z   «       y |j                  t        «      rD| j                  |j                  j                  t        |j                  j                  «      «       y t        j                  |d«       | j                  dd«       y )Ns&   Cannot receive from specified address ó   : zSMTP sender validation failureéÃ  ó3   Requested action aborted: local error in processing)Úcheckr   rê   Úvaluerü   rC   r—   r/   Úrespr!   r+   Úerr©r±   Úfailures     rv   r1  zSMTP._ebFromValidate\  sµ   € Ø�=‰=œÔ'Ø�M‰MØ—‘×"Ñ"à=Ü §¡× 2Ñ 2Ó3ñ4àñô $ G§M¡M×$6Ñ$6Ó7ñ8õð �]‰]œ?Ô+Ø�M‰M˜'Ÿ-™-×,Ñ,¬m¸G¿M¹M×<NÑ<NÓ.OÕPä�G‰G�GÐ=Ô>Ø�M‰M˜#ÐUÕVrw   c           	      ó  — | j                   s| j                  dd«       y | j                  j                  |«      }|s| j                  dd«       y 	 t	        |j                  d«      | j                  | | j                   «      }t        j                  | j                  |«      }|j                  | j                  | j                  |f¬«       y # t        $ r.}| j                  dt        t        |«      «      «       Y d }~y d }~ww xY w)Nr&  s!   Must have sender before recipientr'  r(  r)  r*  )ÚcallbackArgs)rà   rê   Úrcpt_rer­   r5   r,  rá   r   r/   r¥   r	   r-  Ú
validateTor/  Ú_cbToValidateÚ_ebToValidate)r±   r  r2  Úuserr3  Úds         rv   Údo_RCPTzSMTP.do_RCPTm  sÌ   € Ø�zŠzØ�M‰M˜#ÐCÔDØØ�L‰L×Ñ˜tÓ$ˆÙØ�M‰M˜#˜Ô/Øð	Ü˜Ÿ™ ›¨¯©°T¸4¿:¹:ÓFˆDô
 ×Ñ §¡°Ó6ˆØ	�‰�t×)Ñ)¨4×+=Ñ+=ÈTÈGˆÕTøô ò 	Ø�M‰M˜#œ}¬S°«VÓ4Ô5Üûð	ús   Á1C Ã	DÃ$C>Ã>Dc                 ój   — |€|}| j                   j                  ||f«       | j                  ||«       y r|   )râ   r®   rê   )r±   ÚtorH  rü   rí   s        rv   rF  zSMTP._cbToValidate  s.   € Øˆ<ØˆDØ�‰�‰˜˜r˜
Ô#Ø�‰�d˜CÕ rw   c                 ó  — |j                  t        t        «      rD| j                  |j                  j
                  t        |j                  j                  «      «       y t        j                  |«       | j                  dd«       y )Nr:  r;  )
r<  r   r!   rê   r=  rü   r/   r>  r+   r?  r@  s     rv   rG  zSMTP._ebToValidate…  sR   € Ø�=‰=œ¤oÔ6Ø�M‰M˜'Ÿ-™-×,Ñ,¬m¸G¿M¹M×<NÑ<NÓ.OÕPä�G‰G�GÔØ�M‰M˜#ÐUÕVrw   c                 ó¤   — |D ]  }	 |j                  «        Œ y # t        $ r, t        j                  d«       t        j                  «        Y ŒKw xY w)Nz(msg raised exception from connectionLost)r  ÚBaseExceptionr+   rí   r?  )r±   Úmsgsrí   s      rv   Ú_disconnectzSMTP._disconnectŒ  sI   € Øò 	ˆCðØ×"Ñ"Õ$ñ	øô !ò Ü—‘ÐBÔCÜ—‘–	ðús   ‡š2AÁAc                 óª  — | j                   �| j                  s| j                  dd«       y t        | _        | j
                  | j                   }}| j                  }d | _         g | _        d | _        g }|D ]E  \  }}	  |«       }| j                  |||g«      }	|	r|j                  |	«       |j                  |«       ŒG || _        dx| _        | _        | j                  dd«       | j*                  r9d}t!        j,                  |||D ��cg c]  \  }}t/        |«      ‘Œ c}}fz  «       y y # t        $ rM}
| j                  |
j                  |
j                  «       t        | _        | j                  |«       Y d }
~
 y d }
~
wt        $ rF t!        j"                  «        | j                  dd«       t        | _        | j                  |«       Y  y w xY wc c}}w )	Nr&  s'   Must have valid receiver and originatoré&  s   Internal server errorr   éb  s   Continuez-Receiving message for delivery: from=%s to=%s)rà   râ   rê   rš   rß   rá   Ú
datafailedÚreceivedHeaderr  r®   r!   rü   r>  r™   rQ  rO  r+   r?  r  Ú_SMTP__inheaderÚ_SMTP__inbodyÚnoisyrí   r¥   )r±   r  rÕ   ÚoriginÚ
recipientsrP  rH  ÚmsgFuncrí   Úrcvdhdrr3  ÚfmtÚuÚfs                 rv   Údo_DATAzSMTP.do_DATA”  s�  € Ø�:‰:Ð d§h¢hØ�M‰M˜#ÐIÔJØÜˆŒ	Ø—z‘z 4§:¡:ˆfˆØ—X‘Xˆ
àˆŒ
ØˆŒØˆŒàˆØ'ò 	‰MˆD�'ðÙ“i�Ø×-Ñ-¨d°F¸T¸FÓC�ÙØ×$Ñ$ WÔ-Ø—‘˜CÕ ð	ð$ ˆŒà*+Ð+ˆŒ˜$œ-Ø�‰�c˜;Ô'à�:Š:ØAˆCÜ�G‰G�C˜6¸×#D©v°°1¤C¨¥FÓ#DÐEÑEÕFð øô! #ò Ø—‘˜aŸf™f a§f¡fÔ-Ü#�”	Ø× Ñ  Ô&ÝûÜ ò Ü—‘”	Ø—‘˜cÐ#;Ô<Ü#�”	Ø× Ñ  Ô&Úðüó $Es&   Á;?D)ÄGÄ)	GÄ2AE:Å:AGÇGc                 ó>  — | j                   t        u r%	 | j                  D ]  }	 |j                  «        Œ | `| j                  r| j                  «        d | _        | j                  d «       y # t        $ r t        j                  «        Y Œlw xY w# t        $ r Y Œcw xY wr|   )
rß   rš   r  r  rO  r+   r?  rÔ   Ú	_onLogoutrõ   )r±   Úreasonrý   s      rv   r  zSMTP.connectionLost¼  s“   € ð
 �9‰9œÑðØ#Ÿ™ò "�Gð"Ø×.Ñ.Õ0ð"ð
 �Oð �>Š>Ø�N‰NÔØ!ˆDŒNØ�‰˜Õøô )ò "ÜŸ™ž	ð"ûô "ò Ùðús3   ”B ¤A-´B Á-BÂ
B ÂBÂB Â	BÂBc                 óD   — d | _         g | _        | j                  dd«       y )Nr  s   I remember nothing.)rà   râ   rê   r  s     rv   Údo_RSETzSMTP.do_RSETÐ  s   € ØˆŒ
ØˆŒØ�‰�cÐ1Õ2rw   c                 óP  — |d d dk(  rÓ|dk(  rÉt         | _        | j                  r;| j                  | j                  j                  | j                  j
                  «       y | j                  s| j                  d«       y t        j                  | j                  D �cg c]  }|j                  «       ‘Œ c}d¬«      j                  | j                  «       | `y |dd  }| j                  ry 	 | j                  sC| j                  s7d|v rd| _        n+|r)| j                  D ]  }|j                  d«       Œ d| _        |sd| _        | j                  D ]  }|j                  |«       Œ y c c}w # t        $ r2}|| _        | j                  D ]  }|j!                  «        Œ Y d }~y d }~ww xY w)Nrd   r¡   zthrown awayT)ÚconsumeErrorsr    rw   )r™   rß   rU  rê   rü   r>  r  Ú_messageHandledr	   ÚDeferredListÚeomReceivedÚaddCallbackrW  rX  r  r!   r  )r±   r   r2  rý   r3  s        rv   ÚdataLineReceivedzSMTP.dataLineReceivedÕ  sl  € Ø��ˆ8�tÒØ�tŠ|Ü#�”	Ø—?’?Ø—M‘M $§/¡/×"6Ñ"6¸¿¹×8LÑ8LÔMØØ—’Ø×(Ñ(¨Ô7ØÜ×"Ñ"Ø.2¯o©oÖ>¨�Q—]‘]•_Ò>Èdôç‘+˜d×2Ñ2Ô3Ø�OØØ˜˜�8ˆDà�?Š?Øð	)ð —?’?¨4¯=ª=Ø˜4‘<Ø&'�D•OÙØ#'§?¡?ò 2˜Ø×,Ñ,¨SÕ1ð2à$%�D”MáØ !�”àŸ?™?ò +�Ø×$Ñ$ TÕ*ñ+ùò1 ?øô4 ò 	)ØˆDŒOØŸ?™?ò )�Ø×&Ñ&Õ(õ)ûð	)ús   ÂE%Ã*A:E* Å*	F%Å3(F Æ F%c                 óò   — d}|D ]"  \  }}|rŒ	|dz  }t        j                  |«       Œ$ |r:d}t        |«      }|dkD  r|d|› d|› d�z  }| j                  dt	        |«      «       y | j                  dd	«       y )
Nr   rd   zCould not send e-mailz (z failures out of z recipients)rS  r  s   Delivery in progress)r+   r?  r«   rê   r/   )r±   Ú
resultListÚfailuresÚsuccessÚresultrí   Ú	resultLens          rv   ri  zSMTP._messageHandled  s‡   € ØˆØ)ò 	 ‰OˆG�VÚØ˜A‘�Ü—‘˜•ð	 ñ Ø)ˆCÜ˜J›ˆIØ˜1Š}Ø˜˜H˜:Ð%6°y°kÀÐNÑN�Ø�M‰M˜#œ}¨SÓ1Õ2à�M‰M˜#Ð6Õ7rw   c                 óØ   — |\  }}}t        |t        «      r|| _        d| _        n7t        |t        «      rd| _        || _        nt        |j                  › d�«      ‚|| _        d| _        y)zR
        Save the state resulting from a successful anonymous cred login.
        Nz is not a supported interface)	Ú
issubclassr'   rä   rã   r&   ÚRuntimeErrorrÈ   rc  Ú
challenger)r±   rr  ÚifaceÚavatarÚlogouts        rv   Ú_cbAnonymousAuthenticationzSMTP._cbAnonymousAuthentication  sj   € ð #)Ñˆ�˜Ü�eÔ4Ô5Ø#)ˆDÔ Ø ˆD�MÜ˜Ô/Ô0Ø#'ˆDÔ Ø"ˆD�Mä %§.¡.Ð!1Ð1NÐOÓPÐPØˆŒØˆ�rw   c                 óô  ‡ ‡‡— ‰ j                   �‰ j                   j                  «       ‰ _        ‰ j                  �+t        j                  ‰ j                  j
                  ‰‰«      S ‰ j                  r}‰ j                  j                  t        j                  j                  «       dt        t        «      }ˆfd„}|j                  ‰ j                  |«       ˆˆˆ fd„}|j                  |«       |S t!        ‰«      ‚)a  
        Validate the address from which the message originates.

        @type helo: C{(bytes, bytes)}
        @param helo: The argument to the HELO command and the client's IP
        address.

        @type origin: C{Address}
        @param origin: The address the message is from

        @rtype: C{Deferred} or C{Address}
        @return: C{origin} or a C{Deferred} whose callback will be
        passed C{origin}.

        @raise SMTPBadSender: Raised of messages from this address are
        not to be accepted.
        Nc                 ó
  •— | j                  t        j                  j                  «      rt	        ‰«      }n9| j                  t        j                  j
                  «      rt	        ‰d¬«      }n| S t        j                  |«      S )zÉ
                Translate cred exceptions into SMTP exceptions so that the
                protocol code which invokes C{validateFrom} can properly report
                the failure.
                z#Unauthenticated senders not allowed)r>  )r<  r   r
   ÚUnauthorizedLoginr   ÚUnhandledCredentialsr	   Úfail)r?  ÚexcrZ  s     €rv   ÚebAuthenticationz+SMTP.validateFrom.<locals>.ebAuthenticationD  s`   ø€ ð —9‘9œTŸZ™Z×9Ñ9Ô:Ü'¨Ó/‘CØ—Y‘YœtŸz™z×>Ñ>Ô?Ü'ØÐ%Jô‘Cð �JÜ—z‘z #“Ð&rw   c                 ó(   •— ‰j                  ‰‰«      S )zE
                Re-attempt from address validation.
                )r.  )ÚignoredrÕ   rZ  r±   s    €€€rv   ÚcontinueValidationz-SMTP.validateFrom.<locals>.continueValidationV  s   ø€ ð ×(Ñ(¨¨vÓ6Ð6rw   )rä   ÚgetMessageDeliveryrã   r	   r-  r.  ÚportalÚloginr   ÚcredentialsÚ	Anonymousr'   r&   r/  r{  rl  r   )r±   rÕ   rZ  rr  r‚  r…  s   ```   rv   r.  zSMTP.validateFrom!  sÌ   ú€ ð$ ×ÑÐ+Ø ×0Ñ0×CÑCÓEˆDŒMà�=‰=Ð$Ü×&Ñ& t§}¡}×'AÑ'AÀ4ÈÓPÐPð
 �;Š;Ø—[‘[×&Ñ&Ü× Ñ ×*Ñ*Ó,ØÜ'Ü ó	ˆFô'ð  ×Ñ × ?Ñ ?ÐAQÔRö7ð ×ÑÐ1Ô2ØˆMä˜FÓ#Ð#rw   c                 óf   — | j                   �| j                   j                  |«      S t        |«      ‚)a  
        Validate the address for which the message is destined.

        @type user: L{User}
        @param user: The address to validate.

        @rtype: no-argument callable
        @return: A C{Deferred} which becomes, or a callable which
        takes no arguments and returns an object implementing C{IMessage}.
        This will be called and the returned object used to deliver the
        message when it arrives.

        @raise SMTPBadRcpt: Raised if messages to the address are
        not to be accepted.
        )rã   rE  r   ©r±   rH  s     rv   rE  zSMTP.validateToa  s.   € ð  �=‰=Ð$Ø—=‘=×+Ñ+¨DÓ1Ð1Ü˜$ÓÐrw   c                 óº  — | j                   �| j                   j                  |||«      S d}|d   rd|d   z   }t        | j                  j	                  «       j
                  «      }d|d   z   dz   |d   z   dz   |z   dz   }d	|| j                  j                  t        fz  }d
dj                  t        t        |«      «      t        «       fz  }d|z   dz   |z   dz   |z   S )Nrw   r   s    helo=s   from s    ([rd   ó   ]ó   )s   by %s with %s (%s)s
   for %s; %sú s
   Received: s   
	)rã   rV  r/   rë   ÚgetHostrÓ   rÇ   rÈ   r   r¯   Úmapr¥   rD   )	r±   rÕ   rZ  r[  ÚheloStrr°   Úfrom_ÚbyÚfor_s	            rv   rV  zSMTP.receivedHeaderu  sâ   € Ø�=‰=Ð$Ø—=‘=×/Ñ/°°f¸jÓIÐIàˆØ�Š7Ø $ q¡'Ñ)ˆGÜ˜tŸ~™~×5Ñ5Ó7×<Ñ<Ó=ˆà˜4 ™7Ñ" VÑ+¨d°1©gÑ5¸Ñ<¸wÑFÈÑMˆØ" f¨d¯n©n×.EÑ.EÄ{Ð%SÑSˆØ §¡¬¬S°*Ó)=Ó >Ä
ÃÐMÑMˆØ˜uÑ$ wÑ.°Ñ3°gÑ=ÀÑDÐDrw   r”   )rw   )r  s   Sender address accepted)Nr  s   Recipient address accepted)3rÈ   rÆ   rË   rÌ   rö   r‡  rY  rä   rã   rc  r´   ÚpropertyrÓ   Úsetterrî   rð   rø   rê   r  r  r  r	  r  r
  r!  r$  rÏ   ÚqstringrÍ   rÎ   ÚIrÐ   r+  rD  r5  r0  r1  rJ  rF  rG  rQ  ra  r  rf  rm  Ú
state_DATAri  r{  r.  rE  rV  ry   rw   rv   r<   r<   –  s¦  „ ñð €GØ€Fð €Eð €Oð €Hð €Ióð ñó ðð 
‡[�[ñó ðò
(ò
=ò	&ó

ò9ò#ò 1ò
<ò-ò7òRò(ð   $Ñ&¨Ñ6€Gàˆb�j‰jð	 à
ñ	ðñ	ð
 ñ	ðñ	ð 	�‰ˆr�t‰t‰ó€Gð ˆb�j‰jØØ
ñ	ðñ	ð ñ		ð
ñ	ð 	�‰ˆr�t‰t‰ó
€GòKó(!òWò"Uó$!òWòò&GòPò(3ò
()ðT "€Jò8òò">$ò@ ó(Erw   r<   c                   ó.   — e Zd ZdZeZdZeZdZ	dd„Z
d„ Zy)r>   z
    Factory for SMTP.
    rÝ   Nc                 ó   — || _         y r|   )r‡  )r±   r‡  s     rv   r´   zSMTPFactory.__init__�  s	   € Øˆ�rw   c                 óŠ   — t         j                  j                  | |«      }| j                  |_        | j                  |_        |S r|   )r   ÚServerFactoryÚbuildProtocolr‡  r°   rÓ   ©r±   r—   Úps      rv   r   zSMTPFactory.buildProtocol“  s5   € Ü×"Ñ"×0Ñ0°°tÓ<ˆØ—;‘;ˆŒØ—‘ˆŒØˆrw   r|   )rÈ   rÆ   rË   rÌ   r‰   r°   rö   r<   r   r‡  r´   r   ry   rw   rv   r>   r>   „  s'   „ ñð
 €FØ€GØ€Hà€Fóórw   r>   c                   ó¼   — e Zd ZdZdZdZdd„Zd„ Zd„ Ze	j                  fd„Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)r=   aã  
    SMTP client for sending emails.

    After the client has connected to the SMTP server, it repeatedly calls
    L{SMTPClient.getMailFrom}, L{SMTPClient.getMailTo} and
    L{SMTPClient.getMailData} and uses this information to send an email.
    It then calls L{SMTPClient.getMailFrom} again; if it returns L{None}, the
    client will disconnect, otherwise it will continue as normal i.e. call
    L{SMTPClient.getMailTo} and L{SMTPClient.getMailData} and send a new email.
    TNc                 óÖ   — t        |t        «      r|j                  d«      }|xs d| _        g | _        g | _        d | _        g | _        d| _        t        j                  |«      | _        y )NrJ   rw   rž   )r•   r¥   r‹   ÚidentityÚtoAddressesResultÚsuccessAddressesrà   r>  rü   r,   ÚLineLogr+   )r±   r¥  Úlogsizes      rv   r´   zSMTPClient.__init__­  sZ   € Ü�h¤Ô$Ø—‘ wÓ/ˆHà š CˆŒØ!#ˆÔØ "ˆÔØˆŒ
ØˆŒ	ØˆŒ	Ü—<‘< Ó(ˆ�rw   c                 ó˜   — | j                   r| j                  j                  d|z   «       t        j                  j                  | |«       y )Ns   >>> )Údebugr+   r®   r)   ÚLineReceiverrû   r  s     rv   rû   zSMTPClient.sendLine¹  s3   € à�:Š:Ø�H‰H�O‰O˜G d™NÔ+ä×Ñ×#Ñ# D¨$Õ/rw   c                 óŽ   — | j                  | j                  «       dg| _        | j                  | _        | j
                  | _        y rò   )rõ   rö   Ú	_expectedÚsmtpState_heloÚ_okresponseÚsmtpConnectionFailedÚ_failresponserÁ   s    rv   rø   zSMTPClient.connectionMadeÀ  s7   € Ø�‰˜Ÿ™Ô%à˜ˆŒØ×.Ñ.ˆÔØ!×6Ñ6ˆÕrw   c                 ó4   — | j                  d«       d| _        y)z,
        We are no longer connected
        N)rõ   ÚmailFile©r±   rd  s     rv   r  zSMTPClient.connectionLostÇ  s   € ð 	�‰˜ÔØˆ�rw   c                 ól   — | j                  t        dd| j                  j                  «       «      «       y )Nrž   s(   Timeout waiting for SMTP server response)Ú	sendErrorr"   r+   r¥   rÁ   s    rv   rî   zSMTPClient.timeoutConnectionÎ  s(   € Ø�‰ÜØÐ?ÀÇÁÇÁÃóõ	
rw   c           	      ó´  — | j                  «        | j                  r| j                  j                  d|z   «       d }	 t	        |d d «      | _        |dd dk(  ry | j                  j                  |dd  «       |dd d	k(  ry | j
                  | j                  v r6| j                  | j
                  d
j                  | j                  «      «      }n5| j                  | j
                  d
j                  | j                  «      «      }d| _        g | _
        |S # t        $ r: | j                  t        dd|› �| j                  j                  «       «      «       Y y w xY w)Ns   <<< re   rž   z#Invalid response from SMTP server: r   rd   ó   0rf   ó   -ó   
)r  r«  r+   r®   ro   rü   Ú
ValueErrorr·  r    r¥   r>  r®  r°  r¯   r²  )r±   r   Úwhys      rv   r  zSMTPClient.lineReceivedÕ  s1  € Ø×ÑÔð �:Š:Ø�H‰H�O‰O˜G d™NÔ+àˆð	Ü˜D  !˜H›ˆDŒIð ��!ˆ9˜Òàà�	‰	×Ñ˜˜a˜b˜Ô"à��!ˆ9˜Òàà�9‰9˜Ÿ™Ñ&Ø×"Ñ" 4§9¡9¨e¯j©j¸¿¹Ó.CÓD‰Cà×$Ñ$ T§Y¡Y°·
±
¸4¿9¹9Ó0EÓFˆCàˆŒ	ØˆŒ	Øˆ
øô; ò 
	ð �N‰NÜ!ØØ9¸$¸Ð@Ø—H‘H—L‘L“Nóôñ ð
	ús   ¾D ÄA EÅEc                 ól   — | j                  t        ||| j                  j                  «       «      «       y r|   )r·  r   r+   r¥   ©r±   rü   r>  s      rv   r±  zSMTPClient.smtpConnectionFailedÿ  s"   € Ø�‰Ô'¨¨d°D·H±H·L±L³NÓCÕDrw   c                 óœ   — |dk  r5| j                  t        ||| j                  j                  «       «      «       y | j	                  ||«       y )Nr   )r·  r    r+   r¥   ÚsmtpState_msgSentr¿  s      rv   ÚsmtpTransferFailedzSMTPClient.smtpTransferFailed  s9   € Ø�!Š8Ø�N‰NÔ,¨T°4¸¿¹¿¹»ÓHÕIà×"Ñ" 4¨Õ.rw   c                 óx   — | j                  d| j                  z   «       t        | _        | j                  | _        y )Ns   HELO )rû   r¥  ÚSUCCESSr®  ÚsmtpState_fromr°  r¿  s      rv   r¯  zSMTPClient.smtpState_helo  s,   € Ø�‰�h §¡Ñ.Ô/Ü ˆŒØ×.Ñ.ˆÕrw   c                 ó
  — | j                  «       | _        | j                  | _        | j                  �A| j	                  dt        | j                  «      z   «       dg| _        | j                  | _        y | j                  «        y )Ns
   MAIL FROM:r  )
ÚgetMailFromrà   rÂ  r²  rû   rC   r®  ÚsmtpState_tor°  Ú_disconnectFromServerr¿  s      rv   rÅ  zSMTPClient.smtpState_from  si   € Ø×%Ñ%Ó'ˆŒ
Ø!×4Ñ4ˆÔØ�:‰:Ð!Ø�M‰M˜-¬)°D·J±JÓ*?Ñ?Ô@Ø!˜UˆDŒNØ#×0Ñ0ˆDÕð ×&Ñ&Õ(rw   c                 ó8   — | j                   j                  «        y r|   )rë   rì   r¿  s      rv   ÚsmtpState_disconnectzSMTPClient.smtpState_disconnect  s   € Ø�‰×%Ñ%Õ'rw   c                 óÐ   — t        | j                  «       «      | _        g | _        g | _        | j
                  | _        t        dd«      | _        d | _	        | j                  dd«      S )Nr   éè  rw   )
ÚiterÚ	getMailToÚtoAddressesr¦  r§  ÚsmtpState_toOrDatar°  Úranger®  ÚlastAddressr¿  s      rv   rÈ  zSMTPClient.smtpState_to  s\   € Ü §¡Ó 0Ó1ˆÔØ!#ˆÔØ "ˆÔØ×2Ñ2ˆÔÜ˜q $›ˆŒØˆÔØ×&Ñ& q¨#Ó.Ð.rw   c                 óü  — | j                   �U| j                  j                  | j                   ||f«       |t        v r%| j                  j                  | j                   «       	 t        | j                  «      | _         | j                  dt        | j                   «      z   «       y # t        $ rM | j                  r,| j                  d«       dg| _
        | j                  | _        Y y | j                  |d«      cY S w xY w)Ns   RCPT TO:s   DATArT  zNo recipients accepted)rÓ  r¦  r®   rÄ  r§  r}   rÐ  rû   rC   ÚStopIterationr®  ÚsmtpState_datar°  rÁ  r¿  s      rv   rÑ  zSMTPClient.smtpState_toOrData$  sÚ   € Ø×ÑÐ'Ø×"Ñ"×)Ñ)¨4×+;Ñ+;¸TÀ4Ð*HÔIØ”w‰Ø×%Ñ%×,Ñ,¨T×-=Ñ-=Ô>ð
	EÜ# D×$4Ñ$4Ó5ˆDÔð �M‰M˜+¬	°$×2BÑ2BÓ(CÑCÕDøô ò 	NØ×$Ò$Ø—‘˜gÔ&Ø"% �”Ø#'×#6Ñ#6�Ö à×-Ñ-¨dÐ4LÓMÒMð	Nús   Á#B% Â%?C;Ã&C;Ã:C;c                 ó  ‡ — t        j                  «       }|j                  ‰ j                  «       ‰ j                  ‰ j
                  «      }ˆ fd„}|j                  ‰ j                  |«       t        ‰ _	        ‰ j                  ‰ _        y )Nc                 ó<   •— ‰j                  | j                  «       y r|   )r·  r=  )r?  r±   s    €rv   Ú
ebTransferz-SMTPClient.smtpState_data.<locals>.ebTransfer9  s   ø€ Ø�N‰N˜3Ÿ9™9Õ%rw   )r)   Ú
FileSenderÚbeginFileTransferÚgetMailDatarë   ÚtransformChunkr/  ÚfinishedFileTransferrÄ  r®  rÁ  r°  )r±   rü   r>  ÚsrI  rÙ  s   `     rv   rÖ  zSMTPClient.smtpState_data5  sh   ø€ Ü×ÑÓˆØ×Ñ × 0Ñ 0Ó 2°D·N±NÀD×DWÑDWÓXˆô	&ð 	
�‰�t×0Ñ0°*Ô=Ü ˆŒØ×1Ñ1ˆÕrw   c                 ó
  — | j                   �<| j                  ||t        | j                  «      | j                  | j
                  «       g | _        d | _         | j                  d«       t        | _        | j                  | _
        y )Ns   RSET)rà   ÚsentMailr«   r§  r¦  r+   rû   rÄ  r®  rÅ  r°  r¿  s      rv   rÁ  zSMTPClient.smtpState_msgSent@  sm   € Ø�:‰:Ð!Ø�M‰MØ�dœC × 5Ñ 5Ó6¸×8NÑ8NÐPT×PXÑPXôð "$ˆÔØˆŒ
Ø�‰�gÔÜ ˆŒØ×.Ñ.ˆÕrw   c                 óf   — | j                  «        |j                  dd«      j                  dd«      S )a
  
        Perform the necessary local to network newline conversion and escape
        leading periods.

        This method also resets the idle timeout so that as long as process is
        being made sending the message body, the client will not time out.
        r»  s   
ó   
.s   
..)r  Úreplace)r±   Úchunks     rv   rÝ  zSMTPClient.transformChunkO  s.   € ð 	×ÑÔØ�}‰}˜U GÓ,×4Ñ4°X¸yÓIÐIrw   c                 ó:   — |dk7  rd}nd}| j                  |«       y )Nr»  rã  r¡   )rû   )r±   Úlastsentr   s      rv   rÞ  zSMTPClient.finishedFileTransferZ  s    € Ø�uÒØ‰DàˆDØ�‰�dÕrw   c                 ó   — t         ‚)z<
        Return the email address the mail is from.
        ©ÚNotImplementedErrorrÁ   s    rv   rÇ  zSMTPClient.getMailFromc  ó
   € ô "Ð!rw   c                 ó   — t         ‚)z5
        Return a list of emails to send to.
        ré  rÁ   s    rv   rÏ  zSMTPClient.getMailToi  rë  rw   c                 ó   — t         ‚)zˆ
        Return file-like object containing data of message to be sent.

        Lines in the file should be delimited by '\n'.
        ré  rÁ   s    rv   rÜ  zSMTPClient.getMailDatao  s
   € ô "Ð!rw   c                 ó‚   — t        |t        «      r|j                  s| j                  «        y| j	                  dd«       y)a2  
        If an error occurs before a mail message is sent sendError will be
        called.  This base class method sends a QUIT if the error is
        non-fatal and disconnects the connection.

        @param exc: The SMTPClientError (or child class) raised
        @type exc: C{SMTPClientError}
        rž   N)r•   r   ÚisFatalrÉ  rË  ©r±   r�  s     rv   r·  zSMTPClient.sendErrorw  s2   € ô �cœ?Ô+°C·K²KØ×&Ñ&Õ(ð ×%Ñ% b¨$Õ/rw   c                 ó   — t         ‚)a…  
        Called when an attempt to send an email is completed.

        If some addresses were accepted, code and resp are the response
        to the DATA command. If no addresses were accepted, code is -1
        and resp is an informative message.

        @param code: the code returned by the SMTP Server
        @param resp: The string response returned from the SMTP Server
        @param numOk: the number of addresses accepted by the remote host.
        @param addresses: is a list of tuples (address, code, resp) listing
                          the response to each RCPT command.
        @param log: is the SMTP session log
        ré  )r±   rü   r>  ÚnumOkÚ	addressesr+   s         rv   rá  zSMTPClient.sentMail‡  s
   € ô "Ð!rw   c                 ój   — t        dd«      | _        | j                  | _        | j	                  d«       y )Nr   rÍ  s   QUIT)rÒ  r®  rË  r°  rû   rÁ   s    rv   rÉ  z SMTPClient._disconnectFromServer˜  s)   € Ü˜q $›ˆŒØ×4Ñ4ˆÔØ�‰�gÕrw   )é
   )rÈ   rÆ   rË   rÌ   r«  rö   r´   rû   rø   r   ÚconnectionDoner  rî   r  r±  rÂ  r¯  rÅ  rË  rÈ  rÑ  rÖ  rÁ  rÝ  rÞ  rÇ  rÏ  rÜ  r·  rá  rÉ  ry   rw   rv   r=   r=   š  s—   „ ñ	ð €Eð €Gó
)ò0ò7ð %-×$;Ñ$;ó ò
ò(òTEò/ò/ò
	)ò(ò/òEò"	2ò
/ò	Jòò"ò"ò"ò0ò "ó"rw   r=   c                   ó²   — e Zd ZdZdZdZdZdZdZdd„Z	d„ Z
d„ Zdd„Zdd	„Zdd
„Zdd„Zdd„Zdd„Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)r9   a  
    A client for sending emails over ESMTP.

    @ivar heloFallback: Whether or not to fall back to plain SMTP if the C{EHLO}
        command is not recognised by the server. If L{requireAuthentication} is
        C{True}, or L{requireTransportSecurity} is C{True} and the connection is
        not over TLS, this fallback flag will not be honored.
    @type heloFallback: L{bool}

    @ivar requireAuthentication: If C{True}, refuse to proceed if authentication
        cannot be performed. Overrides L{heloFallback}.
    @type requireAuthentication: L{bool}

    @ivar requireTransportSecurity: If C{True}, refuse to proceed if the
        transport cannot be secured. If the transport layer is not already
        secured via TLS, this will override L{heloFallback}.
    @type requireAuthentication: L{bool}

    @ivar context: The context factory to use for STARTTLS, if desired.
    @type context: L{IOpenSSLClientConnectionCreator}

    @ivar _tlsMode: Whether or not the connection is over TLS.
    @type _tlsMode: L{bool}
    TFNc                 ó`   — t        j                  | g|¢­i |¤Ž g | _        || _        || _        y r|   )r=   r´   ÚauthenticatorsÚsecretÚcontext)r±   rú  ÚcontextFactoryÚargsÚkws        rv   r´   zESMTPClient.__init__¾  s0   € Ü×Ñ˜DÐ. 4Ò.¨2Ò.Ø ˆÔØˆŒØ%ˆ�rw   c                 ó¤   — |dk(  r(t        j                  dt        d¬«       | j                  S t	        | j
                  j                  ›d|›�«      ‚)NÚtlsModeúStlsMode attribute of twisted.mail.smtp.ESMTPClient is deprecated since Twisted 13.0rW   ©ÚcategoryÚ
stacklevelz instance has no attribute )ÚwarningsÚwarnÚDeprecationWarningÚ_tlsModerÔ   rÇ   rÈ   )r±   Únames     rv   Ú__getattr__zESMTPClient.__getattr__Ä  sQ   € Ø�9ÒÜ�M‰Mð3ä+Øõ	ð —=‘=Ð ä ð —N‘N×+Ó+Ùðóð rw   c                 ót   — |dk(  r$t        j                  dt        d¬«       || _        y || j                  |<   y )Nr   r  rW   r  )r  r  r  r  r£   )r±   r	  r=  s      rv   Ú__setattr__zESMTPClient.__setattr__Ö  s8   € Ø�9ÒÜ�M‰Mð3ä+Øõ	ð "ˆD�Mà"'ˆD�M‰M˜$Òrw   c                 ól   — | j                  t        dd| j                  j                  «       «      «       y)a�  
        Fail because authentication is required, but the server does not support
        ESMTP, which is required for authentication.

        @param code: The server status code from the most recently received
            server message.
        @type code: L{int}

        @param resp: The server status response from the most recently received
            server message.
        @type resp: L{bytes}
        éö  s,   Server does not support ESMTP AuthenticationN)r·  r   r+   r¥   r¿  s      rv   ÚesmtpEHLORequiredzESMTPClient.esmtpEHLORequiredâ  s*   € ð 	�‰ÜØÐHÈ$Ï(É(Ï,É,Ë.óõ	
rw   c                 ó  — g }| j                   D ]/  }|j                  |j                  «       j                  «       «       Œ1 ddj	                  |«      z  }| j                  t        dd|z  | j                  j                  «       «      «       y)aˆ  
        Fail because authentication is required, but the server does not support
        any schemes we support.

        @param code: The server status code from the most recently received
            server message.
        @type code: L{int}

        @param resp: The server status response from the most recently received
            server message.
        @type resp: L{bytes}
        s   [%s]s   , r  s8   Server does not support Client Authentication schemes %sN)	rù  r®   ÚgetNamer  r¯   r·  r   r+   r¥   )r±   rü   r>  ÚtmpÚaÚauths         rv   ÚesmtpAUTHRequiredzESMTPClient.esmtpAUTHRequiredõ  sz   € ð ˆà×$Ñ$ò 	,ˆAØ�J‰J�q—y‘y“{×(Ñ(Ó*Õ+ð	,ð ˜Ÿ™ C›Ñ(ˆà�‰ÜØØOÐRVÑVØ—‘—‘“óõ	
rw   c                 ól   — | j                  t        dd| j                  j                  «       «      «       y)a`  
        Fail because TLS is required and the server does not support it.

        @param code: The server status code from the most recently received
            server message.
        @type code: L{int}

        @param resp: The server status response from the most recently received
            server message.
        @type resp: L{bytes}
        r  s:   Server does not support secure communication via TLS / SSLN)r·  r$   r+   r¥   r¿  s      rv   ÚesmtpTLSRequiredzESMTPClient.esmtpTLSRequired  s+   € ð 	�‰ÜØØQØ—‘—‘“óõ	
rw   c                 ól   — | j                  t        |d| j                  j                  «       «      «       y)a[  
        Fail because the TLS handshake wasn't able to be completed.

        @param code: The server status code from the most recently received
            server message.
        @type code: L{int}

        @param resp: The server status response from the most recently received
            server message.
        @type resp: L{bytes}
        s(   Could not complete the SSL/TLS handshakeN)r·  r1   r+   r¥   r¿  s      rv   ÚesmtpTLSFailedzESMTPClient.esmtpTLSFailed%  s*   € ð 	�‰ÜØÐEÀtÇxÁxÇ|Á|Ã~óõ	
rw   c                 ól   — | j                  t        ||| j                  j                  «       «      «       y)aM  
        Fail because the authentication was rejected.

        @param code: The server status code from the most recently received
            server message.
        @type code: L{int}

        @param resp: The server status response from the most recently received
            server message.
        @type resp: L{bytes}
        N)r·  r   r+   r¥   r¿  s      rv   ÚesmtpAUTHDeclinedzESMTPClient.esmtpAUTHDeclined7  s$   € ð 	�‰Ô(¨¨t°T·X±X·\±\³^ÓDÕErw   c                 ól   — | j                  t        dd| j                  j                  «       «      «       y)ab  
        Fail because the server sent a malformed authentication challenge.

        @param code: The server status code from the most recently received
            server message.
        @type code: L{int}

        @param resp: The server status response from the most recently received
            server message.
        @type resp: L{bytes}
        r'  sR   Login failed because the SMTP Server returned a malformed Authentication ChallengeN©r·  r   r+   r¥   r¿  s      rv   ÚesmtpAUTHMalformedChallengez'ESMTPClient.esmtpAUTHMalformedChallengeE  s.   € ð 	�‰ÜØðMà—‘—‘“ó	õ	
rw   c                 ól   — | j                  t        ||| j                  j                  «       «      «       y)aP  
        Fail because of some other authentication error.

        @param code: The server status code from the most recently received
            server message.
        @type code: L{int}

        @param resp: The server status response from the most recently received
            server message.
        @type resp: L{bytes}
        Nr  r¿  s      rv   ÚesmtpAUTHServerErrorz ESMTPClient.esmtpAUTHServerErrorZ  s$   € ð 	�‰Ô*¨4°°t·x±x·|±|³~ÓFÕGrw   c                 ó:   — | j                   j                  |«       y)aš  
        Registers an Authenticator with the ESMTPClient. The ESMTPClient will
        attempt to login to the SMTP Server in the order the Authenticators are
        registered. The most secure Authentication mechanism should be
        registered first.

        @param auth: The Authentication mechanism to register
        @type auth: L{IClientAuthentication} implementor

        @return: L{None}
        N)rù  r®   )r±   r  s     rv   ÚregisterAuthenticatorz!ESMTPClient.registerAuthenticatorh  s   € ð 	×Ñ×"Ñ" 4Õ(rw   c                 ó˜   — t        j                  | j                  «      | _        t        j                  | «       | j                  | _        y)zp
        Called when a connection has been made, and triggers sending an C{EHLO}
        to the server.
        N)r   Ú
providedByrë   r  r=   rø   ÚesmtpState_ehlor°  rÁ   s    rv   rø   zESMTPClient.connectionMadev  s6   € ô
 &×0Ñ0°·±Ó@ˆŒÜ×!Ñ! $Ô'Ø×/Ñ/ˆÕrw   c                 ó&  — t         | _        | j                  | _        | j                  | _        | j                  rd}n| j                  }| j                  r| j                  s|s| j                  | _        | j                  d| j                  z   «       y)aè  
        Send an C{EHLO} to the server.

        If L{heloFallback} is C{True}, and there is no requirement for TLS or
        authentication, the client will fall back to basic SMTP.

        @param code: The server status code from the most recently received
            server message.
        @type code: L{int}

        @param resp: The server status response from the most recently received
            server message.
        @type resp: L{bytes}

        @return: L{None}
        Fs   EHLO N)rÄ  r®  ÚesmtpState_serverConfigr°  r  r²  r  ÚrequireTransportSecurityÚheloFallbackÚrequireAuthenticationr¯  rû   r¥  )r±   rü   r>  ÚneedTLSs       rv   r%  zESMTPClient.esmtpState_ehlo  st   € ô" !ˆŒà×7Ñ7ˆÔØ!×3Ñ3ˆÔà�=Š=Ø‰Gà×3Ñ3ˆGà×Ò T×%?Ò%?ÉØ!%×!4Ñ!4ˆDÔà�‰�h §¡Ñ.Õ/rw   c                 óÀ   — i }|j                  «       D ]6  }|j                  dd«      }t        |«      dkD  r|d   ||d   <   Œ/d||d   <   Œ8 | j                  |||«       y)zÜ
        Handle a positive response to the I{EHLO} command by parsing the
        capabilities in the server's response and then taking the most
        appropriate next step towards entering a mail transaction.
        Nrd   r   )rú   rª   r«   ÚtryTLS)r±   rü   r>  Úitemsr   r3  s         rv   r'  z#ESMTPClient.esmtpState_serverConfigŸ  sj   € ð ˆØ—O‘OÓ%ò 	#ˆDØ—
‘
˜4 Ó#ˆAÜ�1‹v˜ŠzØ ™d��a˜‘d’à"��a˜‘d’ð	#ð 	�‰�D˜$ Õ&rw   c                 ó(  — | j                   }| j                  xr d|v }| j                  }|s|s|s| j                  |||«       y|r<dg| _        | j
                  | _        | j                  | _        | j                  d«       y| j                  «        y)a�  
        Take a necessary step towards being able to begin a mail transaction.

        The step may be to ask the server to being a TLS session.  If TLS is
        already in use or not necessary and not available then the step may be
        to authenticate with the server.  If TLS is necessary and not available,
        fail the mail transmission attempt.

        This is an internal helper method.

        @param code: The server status code from the most recently received
            server message.
        @type code: L{int}

        @param resp: The server status response from the most recently received
            server message.
        @type resp: L{bytes}

        @param items: A mapping of ESMTP extensions offered by the server.  Keys
            are extension identifiers and values are the associated values.
        @type items: L{dict} mapping L{bytes} to L{bytes}

        @return: L{None}
        ó   STARTTLSró   N)r  rû  r(  Úauthenticater®  ÚesmtpState_starttlsr°  r  r²  rû   r  )r±   rü   r>  r.  ÚhasTLSÚcanTLSÚmustTLSs          rv   r-  zESMTPClient.tryTLS¯  s…   € ðJ —‘ˆØ—‘Ò6 +°Ð"6ˆØ×/Ñ/ˆá™&¡GØ×Ñ˜d D¨%Õ0ÙØ!˜UˆDŒNØ#×7Ñ7ˆDÔØ!%×!4Ñ!4ˆDÔØ�M‰M˜+Õ&à×!Ñ!Õ#rw   c                 óê   — 	 | j                   j                  | j                  «       d| _        | j                  ||«       y# t        $ r( t        j                  «        | j                  d«       Y ŒCw xY w)zø
        Handle a positive response to the I{STARTTLS} command by starting a new
        TLS session on C{self.transport}.

        Upon success, re-handshake with the server to discover what capabilities
        it has when TLS is in use.
        Tr:  N)	rë   ÚstartTLSrû  r  rO  r+   r?  r  r%  r¿  s      rv   r2  zESMTPClient.esmtpState_starttlsâ  s^   € ð	%Ø�N‰N×#Ñ# D§L¡LÔ1Ø ˆDŒMð 	×Ñ˜T 4Õ(øô ò 	%Ü�G‰GŒIØ×Ñ Ö$ð	%ús   ‚,A Á.A2Á1A2c                 óò  — | j                   �r;|j                  d«      �r)|d   j                  «       }i }|D ]  }d||j                  «       <   Œ | j                  D ]ë  }|j                  «       j                  «       }||v sŒ&|| _        |dk(  r{| j                  | _        | j                  | _
        dg| _        t        j                  | j                  j                  | j                   d«      «      }	| j                  d||	fz  «        y dg| _        | j                   | _        | j"                  | _
        | j                  d|z   «        y  | j$                  r| j'                  «        y | j                  ||«       y )Nó   AUTHrd   ó   PLAINéë   s
   AUTH %s %séN  s   AUTH )rú  Úgetrª   r  rù  r  Ú	_authinforÅ  r°  Ú_esmtpState_plainAuthr²  r®  Úbase64Ú	b64encodeÚchallengeResponserû   ÚesmtpState_challenger   r*  r  )
r±   rü   r>  r.  ÚschemesÚ
tmpSchemesrß  r  r  Ú	challenges
             rv   r1  zESMTPClient.authenticateõ  s]  € Ø�;‹;˜5Ÿ9™9 WÕ-Ø˜G‘n×*Ñ*Ó,ˆGØˆJð ò *�Ø()�
˜1Ÿ7™7›9Ò%ð*ð ×(Ñ(ò �Ø—y‘y“{×(Ñ(Ó*�à˜:Ò%Ø%&�D”Nð ˜xÒ'Ø+/×+>Ñ+>˜Ô(Ø-1×-GÑ-G˜Ô*Ø*-¨˜œÜ$*×$4Ñ$4Ø ŸN™N×<Ñ<¸T¿[¹[È!ÓLó%˜	ð Ÿ™ m°t¸YÐ6GÑ&GÔHñ ð +.¨˜œØ+/×+DÑ+D˜Ô(ð .2×-FÑ-F˜Ô*ØŸ™ h°¡oÔ6Ùð/ð2 ×%Ò%Ø×"Ñ"Õ$à×Ñ  dÕ+rw   c                 óò   — | j                   | _        | j                  | _        dg| _        t        j                  | j                  j                  | j                  d«      «      }| j                  d|z   «       y )Nr;  rW   s   AUTH PLAIN )rÅ  r°  r  r²  r®  r@  rA  r>  rB  rú  rû   )r±   rü   r>  rF  s       rv   r?  z!ESMTPClient._esmtpState_plainAuth  s^   € Ø×.Ñ.ˆÔØ!×3Ñ3ˆÔØ˜ˆŒÜ×$Ñ$ T§^¡^×%EÑ%EÀdÇkÁkÐSTÓ%UÓVˆ	Ø�‰�n yÑ0Õ1rw   c                 ó<   — | j                  | j                  |«       y r|   )Ú_authResponser>  r¿  s      rv   rC  z ESMTPClient.esmtpState_challenge#  s   € Ø×Ñ˜4Ÿ>™>¨4Õ0rw   c                 óž  — | j                   | _        	 t        j                  |«      }|j	                  | j
                  |«      }ddg| _        | j                  | _        | j                  t        j                  |«      «       y # t        j                  $ r6 | j                  d«       | j                  | _        | j                  | _        Y y w xY w)Nr;  r<  ó   *)r  r²  r@  Ú	b64decoderB  rú  r®  ÚsmtpState_maybeAuthenticatedr°  rû   rA  ÚbinasciiÚErrorr  )r±   r  rF  r>  s       rv   rI  zESMTPClient._authResponse&  s¬   € Ø!×3Ñ3ˆÔð	2Ü×(Ñ(¨Ó3ˆIð ×)Ñ)¨$¯+©+°yÓAˆDØ! 3˜ZˆDŒNØ#×@Ñ@ˆDÔØ�M‰Mœ&×*Ñ*¨4Ó0Õ1øô �~‰~ò 	Bà�M‰M˜$ÔØ#×?Ñ?ˆDÔØ!%×!AÑ!AˆDÖð		Bús   “B ÂACÃCc                 óp   — |dk(  r| ` | j                  ||«       y| j                  | j                   |«       y)zä
        Called to handle the next message from the server after sending a
        response to a SASL challenge.  The server response might be another
        challenge or it might indicate authentication has succeeded.
        r;  N)r>  rÅ  rI  r¿  s      rv   rM  z(ESMTPClient.smtpState_maybeAuthenticated5  s6   € ð �3Š;à�Ø×Ñ  dÕ+ð ×Ñ˜tŸ~™~¨tÕ4rw   r|   )rž   N)rÈ   rÆ   rË   rÌ   r)  r*  r(  rû  r  r´   r
  r  r  r  r  r  r  r  r   r"  rø   r%  r'  r-  r2  r1  r?  rC  rI  rM  ry   rw   rv   r9   r9   ž  s’   „ ñð2 €LØ!ÐØ$ÐØ€GØ€Hó&òò$
(ó
ó&
ó8
ó(
ó$Fó
ó*Hò)ò0ò0ò@'ò 1$òf)ò&%,òN2ò1ò2ó5rw   r9   c                   óf   — e Zd ZdZdZdZdZdd„Zd„ Zd„ Z	d„ Z
d„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zy)r8   NFc                 ó`   — t         j                  | «       |€i }|| _        d| _        || _        y )NF)r<   r´   ÚchallengersÚauthenticatedÚctx)r±   Úchalrü  s      rv   r´   zESMTP.__init__K  s/   € Ü�‰�dÔØˆ<ØˆDØˆÔØ"ˆÔØ!ˆ�rw   c                 ó¸   — t         j                  | «       t        j                  | j                  «      | _        | j
                  xr | j                  d u| _        y r|   )r<   rø   r   r$  rë   ÚcanStartTLSrU  rÁ   s    rv   rø   zESMTP.connectionMadeS  sC   € Ü×Ñ˜DÔ!Ü(×3Ñ3°D·N±NÓCˆÔØ×+Ñ+ÒF°·±ÀÐ1EˆÕrw   c                 ó2   — t         j                  | «      dz   S )Ns    ESMTP)r<   rð   rÁ   s    rv   rð   zESMTP.greetingX  s   € Ü�}‰}˜TÓ" YÑ.Ð.rw   c                 óŠ   — dt        | j                  j                  «       «      i}| j                  r| j                  sd|d<   |S )zÚ
        SMTP service extensions

        @return: the SMTP service extensions that are supported.
        @rtype: L{dict} with L{bytes} keys and a value of either L{None} or a
            L{list} of L{bytes}.
        r9  Nr0  )r§   rS  ÚkeysrX  Ú
startedTLS)r±   Úexts     rv   Ú
extensionszESMTP.extensions[  s@   € ð œ˜T×-Ñ-×2Ñ2Ó4Ó5Ð6ˆØ×Ò D§O¢OØ#ˆC�ÑØˆ
rw   c                 óˆ   — t        |«      }t        j                  | |«      }|€t        | d|j	                  «       z   d «      }|S )NÚext_)r.   r<   r	  r  r  )r±   r  r2  s      rv   r	  zESMTP.lookupMethodh  sA   € Ü˜wÓ'ˆä×Ñ˜d GÓ,ˆØˆ9Ü˜˜f w§}¡}£Ñ6¸Ó=ˆAØˆrw   c                 óî   — g }| j                  «       j                  «       D ]B  \  }}|�*|sŒ|j                  |dz   dj                  |«      z   «       Œ2|j                  |«       ŒD dj                  |«      S )Nó    r»  )r^  r.  r®   r¯   )r±   ÚrÚcÚvs       rv   ÚlistExtensionszESMTP.listExtensionsp  sj   € ØˆØ—O‘OÓ%×+Ñ+Ó-ò 	‰DˆAˆqØˆ}Úà—H‘H˜Q ™X¨¯	©	°!«Ñ4Õ5à—‘˜•ð	ð �z‰z˜!‹}Ðrw   c                 ó(  — | j                   j                  «       j                  }t        |t        «      s|j                  d«      }||f| _        d | _        g | _        | j                  d| j                  dz   |z   dz   | j                  «       z   «       y )Nr  r  r   s   , nice to meet you
)rë   rô   rÓ   r•   r–   r‹   rá   rà   râ   rê   rf  )r±   r  r÷   s      rv   Údo_EHLOzESMTP.do_EHLO|  sŽ   € Ø�~‰~×%Ñ%Ó'×,Ñ,ˆä˜$¤Ô&Ø—;‘;˜vÓ&ˆDà˜D�\ˆŒ
ØˆŒ
ØˆŒØ�‰Øà—	‘	Øñàñð *ñ*ð ×%Ñ%Ó'ñ	(õ		
rw   c                 ó  — | j                   r| j                  dd«       y | j                  rK| j                  r?| j                  dd«       | j                  j                  | j                  «       d| _         y | j                  dd«       y )Nr&  s   TLS already negotiatedró   s   Begin TLS negotiation nowTéÆ  s   TLS not available)r\  rê   rU  rX  rë   r7  r  s     rv   Úext_STARTTLSzESMTP.ext_STARTTLS�  sb   € Ø�?Š?Ø�M‰M˜#Ð8Õ9Ø�XŠX˜$×*Ò*Ø�M‰M˜#Ð;Ô<Ø�N‰N×#Ñ# D§H¡HÔ-Ø"ˆD�Oà�M‰M˜#Ð3Õ4rw   c                 óˆ  — | j                   r| j                  dd«       y |j                  d d«      } | j                  j	                  |d   j                  «       d„ «      «       }|s| j                  dd«       y t        | _        || _        t        |«      dkD  r|j                  «        |d   }nd }| j                  |«       y )Nr&  s   Already authenticatedrd   r   c                   ó   — y r|   ry   ry   rw   rv   r   z ESMTP.ext_AUTH.<locals>.<lambda>Ÿ  s   � rw   iø  s    Unrecognized authentication type)rT  rê   rª   rS  r=  r  r›   rß   rw  r«   ÚgetChallengeÚ
state_AUTH)r±   r  r  rV  s       rv   Úext_AUTHzESMTP.ext_AUTHš  s©   € Ø×ÒØ�M‰M˜#Ð7Ô8ØØ—
‘
˜4 Ó#ˆØCˆt×Ñ×#Ñ# E¨!¡H§N¡NÓ$4±lÓCÓEˆÙØ�M‰M˜#ÐBÔCØäˆŒ	ØˆŒäˆu‹:˜Š>Ø×ÑÔà˜‘8‰DàˆDØ�‰˜Õrw   c                 ó@   — t         j                  | |«      }d| _        |S )zz
        Save the state resulting from a successful cred login and mark this
        connection as authenticated.
        T)r<   r{  rT  )r±   Ú	loginInforr  s      rv   Ú_cbAuthenticatedzESMTP._cbAuthenticated¯  s#   € ô
 ×0Ñ0°°yÓAˆØ!ˆÔØˆrw   c                 óÚ   — d| _         |j                  t        j                  j                  «      r| j                  dd«       yt        j                  |d«       | j                  dd«       y)a  
        Handle cred login errors by translating them to the SMTP authenticate
        failed.  Translate all other errors into a generic SMTP error code and
        log the failure for inspection.  Stop all errors from propagating.

        @param reason: Reason for failure.
        Ni  s   Authentication failedzSMTP authentication failurer:  r;  )rF  r<  r   r
   r~  rê   r+   r?  rµ  s     rv   Ú_ebAuthenticatedzESMTP._ebAuthenticated¸  sN   € ð ˆŒØ�<‰<œŸ
™
×4Ñ4Ô5Ø�M‰M˜#Ð7Õ8ä�G‰G�FÐ9Ô:Ø�M‰M˜#ÐUÕVrw   c                 óà  ‡ — ‰ j                   €‰ j                  dd«       t        ‰ _        y|€B‰ j                  j                  «       }t        j                  |«      }‰ j                  d|«       y|dk(  r%‰ j                  dd«       d‰ _        t        ‰ _        y	 t        j                  |«      }‰ j                  j                  |«       ‰ j                  j                  «       rB‰ j                  j                  «       }t        j                  |«      }‰ j                  d|«       yt        ‰ _        ‰ j                   j                  ‰ j                  dt        t         «      }|j#                  ‰ j$                  «       |j#                  ˆ fd	„«       |j'                  ‰ j(                  «       y# t        t        j                  f$ r' ‰ j                  dd«       d‰ _        t        ‰ _        Y yw xY w)
a+  
        Handle one step of challenge/response authentication.

        @param response: The text of a response. If None, this
        function has been called as a result of an AUTH command with
        no initial response. A response of '*' aborts authentication,
        as per RFC 2554.
        Nrj  s    Temporary authentication failurer<  rK  r'  s   Authentication aborteds'   Syntax error in parameters or argumentsc                 ó(   •— ‰j                  dd«      S )Nr;  s   Authentication successful.r  )Úignr±   s    €rv   r   z"ESMTP.state_AUTH.<locals>.<lambda>ö  s   ø€ ˜Ÿ™ cÐ+HÓI€ rw   )r‡  rê   r™   rß   rw  rn  r@  rA  rL  Ú	TypeErrorrN  rO  ÚsetResponseÚmoreChallengesrˆ  r'   r&   rl  rs  Ú
addErrbackru  )r±   ÚresponserF  ÚencodedÚuncodedÚcodedrr  s   `      rv   ro  zESMTP.state_AUTHÇ  s–  ø€ ð �;‰;ÐØ�M‰M˜#ÐBÔCÜˆDŒIØàÐØŸ™×4Ñ4Ó6ˆIÜ×&Ñ& yÓ1ˆGØ�M‰M˜#˜wÔ'Øà�tÒØ�M‰M˜#Ð8Ô9Ø"ˆDŒOÜˆDŒIØð	Ü×&Ñ& xÓ0ˆGð 	�‰×#Ñ# GÔ,Ø�?‰?×)Ñ)Ô+ØŸ™×4Ñ4Ó6ˆIÜ×$Ñ$ YÓ/ˆEØ�M‰M˜#˜uÔ%ØäˆŒ	Ø—‘×"Ñ"Ø�O‰O˜TÔ#:Ô<Ló
ˆð 	×Ñ˜4×0Ñ0Ô1Ø×ÑÛIô	
ð 	×Ñ˜$×/Ñ/Õ0øô+ œ8Ÿ>™>Ð*ò 	Ø�M‰M˜#ÐIÔJØ"ˆDŒOÜˆDŒIÙð		ús   ÂF- Æ-=G-Ç,G-r”   )rÈ   rÆ   rË   rU  rX  r\  rT  r´   rø   rð   r^  r	  rf  rh  rk  rp  rs  ru  ro  ry   rw   rv   r8   r8   D  sT   „ Ø
€CØ€KØ€Jà€Mó"òGò
/òòò
ò
ò(5òò*òWó11rw   r8   c                   ó2   — e Zd ZdZdZd„ Zd„ Zd„ Zd„ Zd„ Z	y)	r7   zi
    Utility class for sending emails easily.

    Use with SMTPSenderFactory or ESMTPSenderFactory.
    r   c                 óh   — | j                   s&d| _         t        | j                  j                  «      S y ©Nrd   )Údoner¥   Úfactoryr7  rÁ   s    rv   rÇ  zSenderMixin.getMailFrom  s(   € Ø�yŠyØˆDŒIÜ�t—|‘|×-Ñ-Ó.Ð.àrw   c                 ó.   — | j                   j                  S r|   )r…  ÚtoEmailrÁ   s    rv   rÏ  zSenderMixin.getMailTo  s   € Ø�|‰|×#Ñ#Ð#rw   c                 ó.   — | j                   j                  S r|   )r…  ÚfilerÁ   s    rv   rÜ  zSenderMixin.getMailData  s   € Ø�|‰|× Ñ Ð rw   c                 ó&  — t         j                  | |«       | j                  j                  dk\  s*|j                  sV|j
                  dk\  r|j
                  dk  s7d| j                  _        | j                  j                  j                  |«       y y y )Nr   i�  r  T)	r=   r·  r…  ÚretriesÚretryrü   ÚsendFinishedrr  Úerrbackrð  s     rv   r·  zSenderMixin.sendError  sm   € ä×Ñ˜T 3Ô'ð �<‰<×Ñ 1Ò$Ø—	’	 3§8¡8¨s¢?°s·x±xÀ#²~à(,ˆD�L‰LÔ%Ø�L‰L×Ñ×'Ñ'¨Õ,ð 8F�	rw   c                 óÊ  — d| j                   _        |t        vr£g }|D ]9  \  }}}	|t        vsŒ|j                  |dz   t	        d|fz  «      z   dz   |	z   «       Œ; |j                   |j
                  «       «       t        ||dj                  |«      |«      }
| j                   j                  j                  |
«       y | j                   j                  j                  ||f«       y )NTr9  z%03drb  r»  )r…  r�  rÄ  r®   r/   r¥   r   r¯   rr  rŽ  Úcallback)r±   rü   r>  rò  ró  r+   Úerrlogr—   ÚacodeÚarespr�  s              rv   rá  zSenderMixin.sentMail   sÌ   € à$(ˆ�‰Ô!Ø”wÑØˆFØ&/ò Ñ"��e˜UØ¤Ò'Ø—M‘MØ˜u™¤}°V¸u¸hÑ5FÓ'GÑGÈ$ÑNÐQVÑVõðð �M‰M˜'˜#Ÿ'™'›)Ô$ä# D¨$°·
±
¸6Ó0BÀIÓNˆCØ�L‰L×Ñ×'Ñ'¨Õ,à�L‰L×Ñ×(Ñ(¨%°Ð);Õ<rw   N)
rÈ   rÆ   rË   rÌ   r„  rÇ  rÏ  rÜ  r·  rá  ry   rw   rv   r7   r7   û  s'   „ ñð €Dòò$ò!ò-ó=rw   r7   c                   ó   — e Zd ZdZy)r?   z|
    SMTP protocol that sends a single email based on information it
    gets from its factory, a L{SMTPSenderFactory}.
    N)rÈ   rÆ   rË   rÌ   ry   rw   rv   r?   r?   3  s   „ òrw   r?   c                   óV   — e Zd ZU dZeZeZee	   e
d<   dd„Zd„ Zd„ Zd„ Zd„ Zd	„ Zd
„ Zy)r@   a¯  
    Utility factory for sending emails easily.

    @type currentProtocol: L{SMTPSender}
    @ivar currentProtocol: The current running protocol returned by
        L{buildProtocol}.

    @type sendFinished: C{bool}
    @ivar sendFinished: When the value is set to True, it means the message has
        been sent or there has been an unrecoverable error or the sending has
        been cancelled. The default value is False.
    r   Nc                 óþ  — t        |t        «      sJ ‚t        |t        «      r|j                  d«      g}nQt        |t        «      r|g}n=g }|D ]4  }t        |t        «      s|j                  d«      }|j                  |«       Œ6 |}t        |«      | _        t        |«      | _	        || _
        || _        || _        | j                  j                  | j                  «       d| _        d| _        | | _        || _        y)ao  
        @param fromEmail: The RFC 2821 address from which to send this
        message.

        @param toEmail: A sequence of RFC 2821 addresses to which to
        send this message.

        @param file: A file-like object containing the message to send.

        @param deferred: A Deferred to callback or errback when sending
        of this message completes.
        @type deferred: L{defer.Deferred}

        @param retries: The number of times to retry delivery of this
        message.

        @param timeout: Period, in seconds, for which to wait for
        server responses, or None to wait forever.
        rJ   FN)r•   ro   r¥   r‹   r–   r®   r4   r7  r«   ÚnEmailsr‡  r‰  rr  ÚaddBothÚ_removeDeferredr�  ÚcurrentProtocolr‹  rö   )	r±   r7  r‡  r‰  Údeferredr‹  rö   ÚtoEmailFinalÚ_emails	            rv   r´   zSMTPSenderFactory.__init__K  så   € ô( ˜'¤3Ô'Ð'Ð'ä�gœsÔ#Ø—~‘~ gÓ.Ð/‰GÜ˜¤Ô'Ø�i‰GàˆLØ!ò ,�Ü! &¬%Ô0Ø#Ÿ]™]¨7Ó3�Fà×#Ñ# FÕ+ð	,ð
 #ˆGä  Ó+ˆŒÜ˜7“|ˆŒØˆŒØˆŒ	ØˆŒØ�‰×Ñ˜D×0Ñ0Ô1Ø!ˆÔØ#ˆÔà�xˆŒØˆ�rw   c                 ó
   — | ` |S r|   )rr  ©r±   rr  s     rv   r™  z!SMTPSenderFactory._removeDeferredz  s   € ØˆKØˆrw   c                 ó(   — | j                  ||«       y r|   ©Ú_processConnectionError©r±   Ú	connectorr?  s      rv   ÚclientConnectionFailedz(SMTPSenderFactory.clientConnectionFailed~  ó   € Ø×$Ñ$ Y°Õ4rw   c                 ó(   — | j                  ||«       y r|   r¡  r£  s      rv   ÚclientConnectionLostz&SMTPSenderFactory.clientConnectionLost�  r¦  rw   c                 óÖ  — d | _         | j                  dk  rq| j                  set        j                  d| j                   z  «       | j
                  j                  dd«       |j                  «        | xj                  dz  c_        y | j                  sV|j                  t        j                  «      rt        dd«      |_        | j                  j                  |j                  «       y y )Nr   z&SMTP Client retrying server. Retry: %srd   rž   zUnable to connect to server.)rš  r‹  r�  r+   rí   r‰  ÚseekÚconnectr<  r
   ÚConnectionDoner   r=  rr  rŽ  r£  s      rv   r¢  z)SMTPSenderFactory._processConnectionError„  s«   € Ø#ˆÔØ�L‰L˜1Ò t×'8Ò'8Ü�G‰GÐ<ÀÇÁ¸}ÑLÔMð �I‰I�N‰N˜1˜aÔ Ø×ÑÔØ�LŠL˜AÑŽLØ×"Ò"ð �y‰yœ×-Ñ-Ô.Ü,¨RÐ1OÓP�”	Ø�K‰K×Ñ §	¡	Õ*ð #rw   c                 óæ   — | j                  | j                  | j                  dz  dz   «      }| |_        | j                  |_        || _        | j                  j                  | j                  «       |S )NrW   )	r   r°   r—  r…  rö   rš  rr  r˜  Ú_removeProtocolr¡  s      rv   r   zSMTPSenderFactory.buildProtocol•  s[   € Ø�M‰M˜$Ÿ+™+ t§|¡|°aÑ'7¸!Ñ';Ó<ˆØˆŒ	Ø—L‘LˆŒ	Ø ˆÔØ�‰×Ñ˜D×0Ñ0Ô1Øˆrw   c                 ó,   — | j                   rd| _         |S )z×
        Remove the protocol created in C{buildProtocol}.

        @param result: The result/error passed to the callback/errback of
            L{defer.Deferred}.

        @return: The C{result} untouched.
        N)rš  rŸ  s     rv   r®  z!SMTPSenderFactory._removeProtocol�  s   € ð ×ÒØ#'ˆDÔ Øˆrw   )rg   N)rÈ   rÆ   rË   rÌ   r‰   r°   r?   r   r   r=   Ú__annotations__r´   r™  r¥  r¨  r¢  r   r®  ry   rw   rv   r@   r@   :  sA   … ñð €FØ!+€Hˆd�:ÑÓ+ó-ò^ò5ò5ò+ò"órw   r@   c                   ó   — e Zd ZdZd„ Zy)r   a&  
    L{LOGINCredentials} generates challenges for I{LOGIN} authentication.

    For interoperability with Outlook, the challenge generated does not exactly
    match the one defined in the
    U{draft specification<http://sepp.oetiker.ch/sasl-2.1.19-ds/draft-murchison-sasl-login-00.txt>}.
    c                 ó@   — t        j                  | «       ddg| _        y )Ns	   Password:s	   Username:)Ú_lcredentialsr´   Ú
challengesrÁ   s    rv   r´   zLOGINCredentials.__init__´  s   € Ü×Ñ˜tÔ$Ø'¨Ð6ˆ�rw   N)rÈ   rÆ   rË   rÌ   r´   ry   rw   rv   r   r   «  s   „ ñó7rw   r   c                   ó    — e Zd Zd„ Zd„ Zdd„Zy)r3   c                 ó   — || _         y r|   ©rH  rŒ  s     rv   r´   zPLAINAuthenticator.__init__»  s	   € Øˆ�	rw   c                  ó   — y)Nr:  ry   rÁ   s    rv   r  zPLAINAuthenticator.getName¾  s   € Ørw   c                 óz   — |dk(  r"| j                   dz   | j                   z   dz   |z   S d| j                   z   dz   |z   S )Nrd   ó    r·  )r±   rú  rV  s      rv   rB  z$PLAINAuthenticator.challengeResponseÁ  sD   € Ø�1Š9Ø—9‘9˜uÑ$ t§y¡yÑ0°5Ñ8¸6ÑAÐAà˜4Ÿ9™9Ñ$ uÑ,¨vÑ5Ð5rw   N)rd   )rÈ   rÆ   rË   r´   r  rB  ry   rw   rv   r3   r3   ¹  s   „ òòô6rw   r3   c                   ó(   — e Zd ZdZdZdd„Zd„ Zd„ Zy)r:   TNc                 óÈ   — d| _         || _        |j                  dd «      | _        |€| j	                  «       }t        j                  | ||g|¢­i |¤Ž | j                  «        y )Nr   Úhostname)r)  ÚusernameÚpopÚ	_hostnameÚ_getContextFactoryr9   r´   Ú_registerAuthenticators)r±   r¾  rú  rü  rý  rþ  s         rv   r´   zESMTPSender.__init__Ì  s_   € ØˆÔØ ˆŒàŸ™ 
¨DÓ1ˆŒàÐ!Ø!×4Ñ4Ó6ˆNä×Ñ˜T 6¨>ÐG¸DÒGÀBÒGà×$Ñ$Õ&rw   c                 óÜ   — | j                  t        | j                  «      «       | j                  t        | j                  «      «       | j                  t	        | j                  «      «       y r|   )r"  r   r¾  r   r3   rÁ   s    rv   rÂ  z#ESMTPSender._registerAuthenticatorsÙ  sJ   € à×"Ñ"Ô#=¸d¿m¹mÓ#LÔMØ×"Ñ"Ô#5°d·m±mÓ#DÔEØ×"Ñ"Ô#5°d·m±mÓ#DÕErw   c                 ó    — | j                   �| j                   S | j                  €y 	 ddlm}  || j                  «      }|S # t        $ r Y y w xY w)Nr   )ÚoptionsForClientTLS)rû  rÀ  Útwisted.internet.sslrÅ  ÚImportError)r±   rÅ  rû  s      rv   rÁ  zESMTPSender._getContextFactoryß  sT   € Ø�<‰<Ð#Ø—<‘<ÐØ�>‰>Ð!Øð	Ý@ñ *¨$¯.©.Ó9ˆGØˆNøô	 ò 	Ùð	ús   §A Á	AÁAr|   )rÈ   rÆ   rË   r*  r(  r´   rÂ  rÁ  ry   rw   rv   r:   r:   È  s   „ Ø ÐØ#Ðó'òFórw   r:   c                   ó0   — e Zd ZdZeZ	 	 	 	 	 	 	 dd„Zd„ Zy)r;   z¼
    Utility factory for sending emails easily.

    @type currentProtocol: L{ESMTPSender}
    @ivar currentProtocol: The current running protocol as made by
        L{buildProtocol}.
    Nc           	      óœ   — t         j                  | ||||||«       || _        || _        |	| _        |
| _        || _        || _        || _        y r|   )	r@   r´   r¾  ÚpasswordÚ_contextFactoryÚ_heloFallbackÚ_requireAuthenticationÚ_requireTransportSecurityrÀ  )r±   r¾  rÊ  r7  r‡  r‰  r›  r‹  rö   rü  r)  r*  r(  r½  s                 rv   r´   zESMTPSenderFactory.__init__ø  sX   € ô  	×"Ñ"Ø�)˜W d¨H°g¸wô	
ð !ˆŒØ ˆŒØ-ˆÔØ)ˆÔØ&;ˆÔ#Ø)AˆÔ&Ø!ˆ�rw   c                 ó¦  — | j                  | j                  | j                  | j                  | j                  | j
                  dz  dz   | j                  ¬«      }| j                  |_        | j                  |_
        | j                  |_        | |_        | j                  |_        || _        | j                   j#                  | j$                  «       |S )a)  
        Build an L{ESMTPSender} protocol configured with C{heloFallback},
        C{requireAuthentication}, and C{requireTransportSecurity} as specified
        in L{__init__}.

        This sets L{currentProtocol} on the factory, as well as returning it.

        @rtype: L{ESMTPSender}
        rW   )r½  )r   r¾  rÊ  rË  r°   r—  rÀ  rÌ  r)  rÍ  r*  rÎ  r(  r…  rö   rš  rr  r˜  r®  r¡  s      rv   r   z ESMTPSenderFactory.buildProtocol  s¯   € ð �M‰MØ�M‰MØ�M‰MØ× Ñ Ø�K‰KØ�L‰L˜1Ñ˜qÑ Ø—^‘^ð ó 
ˆð ×+Ñ+ˆŒØ"&×"=Ñ"=ˆÔØ%)×%CÑ%CˆÔ"ØˆŒ	Ø—L‘LˆŒ	Ø ˆÔØ�‰×Ñ˜D×0Ñ0Ô1Øˆrw   )rg   NNFTTN)rÈ   rÆ   rË   rÌ   r:   r   r´   r   ry   rw   rv   r;   r;   í  s/   „ ñð €Hð ØØØØ"Ø!%Øó"ó6rw   r;   é   Fc                 ó´  ‡‡— t        |d«      st        t        |«      «      }ˆˆfd„}t        j                  |«      }t        |t        «      r|j                  d«      }t        |t        «      r|j                  d«      }| }t        |t        «      st        |«      }t        ||||||d|	|
|¬«
      Š|�t        |«      ‰_         |j                  | |‰«      Š|S )aR
  
    Send an email.

    This interface is intended to be a replacement for L{smtplib.SMTP.sendmail}
    and related methods. To maintain backwards compatibility, it will fall back
    to plain SMTP, if ESMTP support is not available. If ESMTP support is
    available, it will attempt to provide encryption via STARTTLS and
    authentication if a secret is provided.

    @param smtphost: The host the message should be sent to.
    @type smtphost: L{bytes}

    @param from_addr: The (envelope) address sending this mail.
    @type from_addr: L{bytes}

    @param to_addrs: A list of addresses to send this mail to.  A string will
        be treated as a list of one address.
    @type to_addrs: L{list} of L{bytes} or L{bytes}

    @param msg: The message, including headers, either as a file or a string.
        File-like objects need to support read() and close(). Lines must be
        delimited by '\n'. If you pass something that doesn't look like a file,
        we try to convert it to a string (so you should be able to pass an
        L{email.message} directly, but doing the conversion with
        L{email.generator} manually will give you more control over the process).

    @param senderDomainName: Name by which to identify. If None, try to pick
        something sane (but this depends on external configuration and may not
        succeed).
    @type senderDomainName: L{bytes}

    @param port: Remote port to which to connect.
    @type port: L{int}

    @param username: The username to use, if wanting to authenticate.
    @type username: L{bytes} or L{unicode}

    @param password: The secret to use, if wanting to authenticate. If you do
        not specify this, SMTP authentication will not occur.
    @type password: L{bytes} or L{unicode}

    @param requireTransportSecurity: Whether or not STARTTLS is required.
    @type requireTransportSecurity: L{bool}

    @param requireAuthentication: Whether or not authentication is required.
    @type requireAuthentication: L{bool}

    @param reactor: The L{reactor} used to make the TCP connection.

    @rtype: L{Deferred}
    @returns: A cancellable L{Deferred}, its callback will be called if a
        message is sent to ANY address, the errback if no message is sent. When
        the C{cancel} method is called, it will stop retrying and disconnect
        the connection immediately.

        The callback will be called with a tuple (numOk, addresses) where numOk
        is the number of successful recipient addresses and addresses is a list
        of tuples (address, code, resp) giving the response to the RCPT command
        for each address.
    Úreadc                 ó–   •— d‰_         ‰j                  r%‰j                  j                  j                  «        y‰j	                  «        y)z¿
        Cancel the L{twisted.mail.smtp.sendmail} call, tell the factory not to
        retry and disconnect the connection.

        @param d: The L{defer.Deferred} to be cancelled.
        TN)r�  rš  rë   ÚabortConnectionÚ
disconnect)rI  r¤  r…  s    €€rv   Úcancelzsendmail.<locals>.cancel|  s<   ø€ ð  $ˆÔØ×"Ò"Ø×#Ñ#×-Ñ-×=Ñ=Õ?ð × Ñ Õ"rw   zutf-8T)r)  r*  r(  r½  )Úhasattrr   r–   r	   ÚDeferredr•   r¥   r‹   r   r;   r/   r°   Ú
connectTCP)ÚsmtphostÚ	from_addrÚto_addrsrí   ÚsenderDomainNameÚportr   r¾  rÊ  r*  r(  rÖ  rI  ÚtlsHostnamer¤  r…  s                 @@rv   r6   r6   /  sÔ   ù€ ôR �3˜Ôä”e˜C“jÓ!ˆõ#ô 	�‰�vÓ€Aä�(œCÔ Ø—?‘? 7Ó+ˆÜ�(œCÔ Ø—?‘? 7Ó+ˆà€KÜ�k¤3Ô'Ü Ó,ˆä ØØØØØØ	ØØ3Ø!9Øô€Gð Ð#Ü&Ð'7Ó8ˆŒà"�×"Ñ" 8¨T°7Ó;€Ià€Hrw   c                 ó  — g }t        | «      D ][  }t        |«      }|dk(  s|dk(  s
|dk  s|dkD  r|j                  t        d|d›�«      «       ŒA|j                  t	        |f«      «       Œ] dj                  |«      t        | «      fS )Nú+ú=é!   é~   Ú02Xrw   )r-   Úordr®   r/   r–   r¯   r«   )rß  Úerrorsrc  ÚchÚos        rv   rI   rI   ­  s€   € Ø
€AÜ˜‹lò "ˆÜ�‹GˆØ�Š9˜˜cš	 Q¨¢V¨q°3ªwØ�H‰H”] Q q¨ g ;Ó/Õ0à�H‰H”U˜A˜4“[Õ!ð"ð �H‰H�Q‹Kœ˜Q›Ð Ð rw   c                 óÒ  — g }d}|t        | «      k  r‹| ||dz    dk(  r=	 |j                  t        t        t	        | |dz   |dz    «      d«      «      «       |dz  }n4|j                  t	        | ||dz    «      j                  d«      «       |dz  }|t        | «      k  rŒ‹dj                  |«      t        | «      fS # t
        $ r# |j                  t        | ||dz    «      «       Y Œ�w xY w)z¡
    Decode the xtext-encoded string C{s}.

    @param s: String to decode.
    @param errors: codec error handling scheme.
    @return: The decoded string.
    r   rd   ó   +re   é   rJ   r�   )	r«   r®   Úchrro   r–   r¼  ræ  rŠ   r¯   )rß  rç  rc  rz   s       rv   rH   rH   ¸  sè   € ð 	€AØ	€AØ
Œc�!‹fŠ*ØˆQ��Q‘ˆ<˜4Òð,Ø—‘œœS¤ q¨¨Q©°°Q±Ð'7Ó!8¸"Ó=Ó>Ô?ð �‰F‰Aà�H‰H”U˜1˜Q  Q¡˜<Ó(×/Ñ/°Ó8Ô9Ø�‰FˆAð Œc�!‹f‹*ð �G‰G�A‹Jœ˜A›ÐÐøô ò ,Ø—‘œ˜Q˜q 1 q¡5˜\Ó*Ö+ð,ús   Ÿ6B: Â:)C&Ã%C&c                   ó   — e Zd Zdd„Zy)rE   c                 ó   — t        |«      S r|   )rH   ©r±   rß  rç  s      rv   rŠ   zxtextStreamReader.decodeÐ  ó   € Ü˜A‹Ðrw   N©Ústrict©rÈ   rÆ   rË   rŠ   ry   rw   rv   rE   rE   Ï  ó   „ ôrw   rE   c                   ó   — e Zd Zdd„Zy)rF   c                 ó   — t        |«      S r|   )rI   rð  s      rv   rŠ   zxtextStreamWriter.decodeÕ  rñ  rw   Nrò  rô  ry   rw   rv   rF   rF   Ô  rõ  rw   rF   c                 ó:   — | dk(  rt         t        t        t        fS y )NÚxtext)rI   rH   rE   rF   )r	  s    rv   rG   rG   Ù  s   € Øˆw‚ÜœlÔ,=Ô?PÐQÐQð rw   rƒ  r|   )yrÌ   r@  rN  r„   r†   rÍ   Úsocketrh   r  Úemail.utilsr   Úior   Útypingr   Úzope.interfacer   Útwistedr   Útwisted.copyrightr   Útwisted.internetr	   r
   r   r   Útwisted.internet._idnar   Útwisted.internet.interfacesr   r   Útwisted.mail._credr   r   r   r³  Útwisted.mail._exceptr   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r1   r$   Útwisted.mail.interfacesr%   r&   r'   r(   r2   Útwisted.protocolsr)   r*   Útwisted.pythonr+   r,   Útwisted.python.compatr-   r.   r/   Útwisted.python.runtimer0   Ú__all__ÚisMacOSXÚgethostnamer‹   r‰   ÚgetfqdnÚdictÚfromkeysrÒ  rÄ  rD   rA   r~   rB   rC   r™   rš   r›   rÏ   r4   r5   ÚLineOnlyReceiverÚTimeoutMixinr<   rŸ  r>   r¬  r=   r9   r8   r7   r?   ÚClientFactoryr@   r3   r:   r;   r6   ÚcodecsrI   rH   ÚStreamReaderrE   ÚStreamWriterrF   rG   Úregisterry   rw   rv   ú<module>r     s€  ðñó
 Û Û 	Û Û 	Û Û Û Ý !Ý Ý å &å Ý )ß <Ó <Ý ,ß D÷ñ ÷
÷ ÷ ÷ ÷ ÷(ó ÷ .ß $ß HÑ HÝ +ò1€ðl €8×ÑÔð !ˆf× Ñ Ó"×)Ñ)¨'Ó2�Gàˆf�n‰nÓ×%Ñ% gÓ.€Gð �-‰-™˜c 3›Ó
(€ó9òxñ ƒ}€ð Ñ-ó ò*4ð* 0Ñ €ˆˆtð +€÷p
ñ p
÷f% ñ % ôPkEˆ5×!Ñ! 8×#8Ñ#8ô kEô\�(×(Ñ(ô ô,A�×#Ñ# X×%:Ñ%:ô AôHc5�*ô c5ôLt1ˆDô t1÷n5=ñ 5=ôp�˜jô ôn˜×.Ñ.ô nôb7�}ô 7ñ Ð"Ó#÷6ð 6ó $ð6ô"�+˜{ô "ôJ?Ð*ô ?ðN Ø	ØØØØØ"óxóv ó!ó ô.˜×+Ñ+ô ô
˜×+Ñ+ô ò
Rð
 €‡��Õ rw   