AlkantarClanX12

Your IP : 3.145.37.219


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/smtplib.cpython-33.pyo

�
��f��c@sMdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZ
ddlmZddddd	d
ddd
dddgZdZdZdZdZdZejdej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	e�ZGdd
�d
e�ZGdd�de�Z Gdd�de�Z!Gdd
�d
e�Z"d d�Z#d!d"�Z$d#d�Z%d$d%�Z&d&d'�Z'yddl(Z(Wne)k
re*Z+YnXe,Z+Gd(d�d�Z-e+raGd)d*�d*e-�Z.ej/d*�nd+Z0Gd,d-�d-e-�Z1e2d.krIddlZd/d0�Z3e3d1�Z4e3d2�j5d3�Z6e7d4�d5Z8x'ej9j:�Z;e;r�Pne8e;Z8q�e7d6e<e8��e-d7�Z=e=j>d8�e=j?e4e6e8�e=j@�ndS(9uSMTP/ESMTP client class.

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

Notes:

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

Example:

  >>> import smtplib
  >>> s=smtplib.SMTP("localhost")
  >>> print(s.help())
  This is Sendmail version 8.8.4
  Topics:
      HELO    EHLO    MAIL    RCPT    DATA
      RSET    NOOP    QUIT    HELP    VRFY
      EXPN    VERB    ETRN    DSN
  For more info use "HELP <topic>".
  To report bugs in the implementation send email to
      sendmail-bugs@sendmail.org.
  For local information send email to Postmaster at your site.
  End of HELP info
  >>> s.putcmd("vrfy","someone@here")
  >>> s.getreply()
  (250, "Somebody OverHere <somebody@here.my.org>")
  >>> s.quit()
iN(ubody_encode(ustderru
SMTPExceptionuSMTPServerDisconnecteduSMTPResponseExceptionuSMTPSenderRefuseduSMTPRecipientsRefusedu
SMTPDataErroruSMTPConnectErroru
SMTPHeloErroruSMTPAuthenticationErroru	quoteaddru	quotedatauSMTPii�u
s
i u	auth=(.*)cBs|EeZdZdZdS(u
SMTPExceptionu4Base class for all exceptions raised by this module.N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu
SMTPExceptionFscBs|EeZdZdZdS(uSMTPServerDisconnectedu�Not connected to any SMTP server.

    This exception is raised when the server unexpectedly disconnects,
    or when an attempt is made to use the SMTP instance before
    connecting it to a server.
    N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuSMTPServerDisconnectedIscBs&|EeZdZdZdd�ZdS(uSMTPResponseExceptionu2Base class for all exceptions that include an SMTP error code.

    These exceptions are generated in some instances when the SMTP
    server returns an error code.  The error code is stored in the
    `smtp_code' attribute of the error, and the `smtp_error' attribute
    is set to the error message.
    cCs%||_||_||f|_dS(N(u	smtp_codeu
smtp_erroruargs(uselfucodeumsg((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu__init__Zs		uSMTPResponseException.__init__N(u__name__u
__module__u__qualname__u__doc__u__init__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuSMTPResponseExceptionQscBs&|EeZdZdZdd�ZdS(uSMTPSenderRefusedu�Sender address refused.

    In addition to the attributes set by on all SMTPResponseException
    exceptions, this sets `sender' to the string that the SMTP refused.
    cCs1||_||_||_|||f|_dS(N(u	smtp_codeu
smtp_errorusenderuargs(uselfucodeumsgusender((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu__init__fs			uSMTPSenderRefused.__init__N(u__name__u
__module__u__qualname__u__doc__u__init__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuSMTPSenderRefused_scBs&|EeZdZdZdd�ZdS(uSMTPRecipientsRefusedu�All recipient addresses refused.

    The errors for each recipient are accessible through the attribute
    'recipients', which is a dictionary of exactly the same sort as
    SMTP.sendmail() returns.
    cCs||_|f|_dS(N(u
recipientsuargs(uselfu
recipients((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu__init__ts	uSMTPRecipientsRefused.__init__N(u__name__u
__module__u__qualname__u__doc__u__init__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuSMTPRecipientsRefusedlscBs|EeZdZdZdS(u
SMTPDataErroru'The SMTP server didn't accept the data.N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu
SMTPDataErroryscBs|EeZdZdZdS(uSMTPConnectErroru&Error during connection establishment.N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuSMTPConnectError|scBs|EeZdZdZdS(u
SMTPHeloErroru"The server refused our HELO reply.N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu
SMTPHeloErrorscBs|EeZdZdZdS(uSMTPAuthenticationErroruvAuthentication error.

    Most probably the server didn't accept the username/password
    combination provided.
    N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuSMTPAuthenticationError�scCsStjj|�\}}||fdkrK|j�jd�rC|Sd|Sd|S(u�Quote a subset of the email addresses defined by RFC 821.

    Should be able to handle anything email.utils.parseaddr can handle.
    uu<u<%s>(uu(uemailuutilsu	parseaddrustripu
startswith(u
addrstringudisplaynameuaddr((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu	quoteaddr�scCs2tjj|�\}}||fdkr.|S|S(Nu(uu(uemailuutilsu	parseaddr(u
addrstringudisplaynameuaddr((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu
_addr_only�su
_addr_onlycCs"tjddtjdt|��S(u�Quote data for email.

    Double leading '.', and change Unix newline '\n', or Mac '\r' into
    Internet CRLF end-of-line.
    u(?m)^\.u..u(?:\r\n|\n|\r(?!\n))(ureusubuCRLF(udata((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu	quotedata�scCstjdd|�S(Ns(?m)^\.s..(ureusub(ubindata((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu_quote_periods�su_quote_periodscCstjdt|�S(Nu(?:\r\n|\n|\r(?!\n))(ureusubuCRLF(udata((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu	_fix_eols�su	_fix_eolscBs�|EeZdZdZdZd>Zd>ZdZd>Z	dZ
eZddd>e
jd>dd�Zdd�Zd	d
�Zdd�Zd
d�Zddd>dd�Zdd�Zddd�Zdd�Zddd�Zddd�Zddd�Zdd�Zdd d!�Zd"d#�Zd$d%�Zgd&d'�Zgd(d)�Z d*d+�Z!d,d-�Z"e"Z#d.d/�Z$d0d1�Z%d2d3�Z&d>d>d>d4d5�Z'ggd6d7�Z(d>d>gid8d9�Z)d:d;�Z*d<d=�Z+d>S(?uSMTPu�This class manages a connection to an SMTP or ESMTP server.
    SMTP Objects:
        SMTP objects have the following attributes:
            helo_resp
                This is the message given by the server in response to the
                most recent HELO command.

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

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

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

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

        See each method's docstrings for details.  In general, there is a
        method of the same name to perform each SMTP command.  There is also a
        method called 'sendmail' that will do an entire mail transaction.
        iuehlouc
Cs�||_i|_||_|rZ|j||�\}}|dkrZt||��qZn|dk	rr||_nhtj�}d|kr�||_nDd}	ytj	tj
��}	Wntjk
r�YnXd|	|_dS(uInitialize a new instance.

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

        i�u.u	127.0.0.1u[%s]N(utimeoutuesmtp_featuresusource_addressuconnectuSMTPConnectErroruNoneulocal_hostnameusocketugetfqdnu
gethostbynameugethostnameugaierror(
uselfuhostuportulocal_hostnameutimeoutusource_addressucodeumsgufqdnuaddr((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu__init__�s$			u
SMTP.__init__cCs|S(N((uself((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu	__enter__suSMTP.__enter__cGsbzPy7|jd�\}}|dkr9t||��nWntk
rNYnXWd|j�XdS(NuQUITi�(udocmduSMTPResponseExceptionuSMTPServerDisconnecteduclose(uselfuargsucodeumessage((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu__exit__	s
	u
SMTP.__exit__cCs
||_dS(u�Set the debug output level.

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

        N(u
debuglevel(uselfu
debuglevel((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuset_debuglevelsuSMTP.set_debuglevelcCsM|jdkr1td||f|jdt�ntj||f||j�S(Niuconnect: toufile(u
debugleveluprintusource_addressustderrusocketucreate_connection(uselfuhostuportutimeout((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu_get_sockets

uSMTP._get_socketu	localhostcCsS|r||_n|r�|jd�|jd�kr�|jd�}|dkr�|d|�||dd�}}yt|�}Wq�tk
r�tjd��Yq�Xq�n|s�|j}n|jdkr�t	d||fdt
�n|j|||j�|_
d|_|j�\}}|jdkrIt	d|dt
�n||fS(upConnect to a host on a given port.

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

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

        u:iNiunonnumeric portuconnect:ufile(usource_addressufindurfinduintu
ValueErrorusocketuerrorudefault_portu
debugleveluprintustderru_get_socketutimeoutusockuNoneufileugetreply(uselfuhostuportusource_addressuiucodeumsg((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuconnect%s(%%
	uSMTP.connectcCs�|jdkr+tdt|�dt�nt|d�r�|jr�t|t�rd|jd�}ny|jj	|�Wq�t
jk
r�|j�t
d��Yq�Xnt
d��dS(	uSend `s' to the server.iusend:ufileusockuasciiuServer not connecteduplease run connect() firstN(u
debugleveluprintureprustderruhasattrusocku
isinstanceustruencodeusendallusocketuerrorucloseuSMTPServerDisconnected(uselfus((u,/opt/alt/python33/lib64/python3.3/smtplib.pyusendGs
u	SMTP.sendcCsC|dkrd|tf}nd||tf}|j|�dS(uSend a command to the server.uu%s%su%s %s%sN(uCRLFusend(uselfucmduargsustr((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuputcmdVsuSMTP.putcmdcCs�g}|jdkr-|jjd�|_nxLy|jjtd�}WnHtjk
r�}z%|j�t	dt
|���WYdd}~XnX|s�|j�t	d��n|jdkr�tdt
|�dt�nt|�tkrtd	d
��n|j|dd�jd��|dd
�}yt|�}Wntk
r^d}PYnX|d
d�dkr0Pq0q0dj|�}|jdkr�td||fdt�n||fS(u�Get a reply from the server.

        Returns a tuple consisting of:

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

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

        Raises SMTPServerDisconnected if end-of-file is reached.
        urbiu Connection unexpectedly closed: NuConnection unexpectedly closediureply:ufilei�uLine too long.is 	
is-s
ureply: retcode (%s); Msg: %si����(ufileuNoneusockumakefileureadlineu_MAXLINEusocketuerrorucloseuSMTPServerDisconnectedustru
debugleveluprintureprustderrulenuSMTPResponseExceptionuappendustripuintu
ValueErrorujoin(uselfurespulineueucodeuerrcodeuerrmsg((u,/opt/alt/python33/lib64/python3.3/smtplib.pyugetreply^s>

#
 

u
SMTP.getreplycCs|j||�|j�S(u-Send a command, and return its response code.(uputcmdugetreply(uselfucmduargs((u,/opt/alt/python33/lib64/python3.3/smtplib.pyudocmd�su
SMTP.docmdcCs>|jd|p|j�|j�\}}||_||fS(uwSMTP 'helo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        uhelo(uputcmdulocal_hostnameugetreplyu	helo_resp(uselfunameucodeumsg((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuhelo�s	u	SMTP.heloc
Cs�i|_|j|j|p!|j�|j�\}}|d
krnt|�dkrn|j�td��n||_|dkr�||fSd|_	|jj
d�jd�}|d=x�|D]�}tj
|�}|r|jjdd�d	|jd�d|jd<q�ntj
d
|�}|r�|jd�j�}|j|jd�d�j�}	|dkr�|jj|d�d	|	|j|<q�|	|j|<q�q�W||fS(ux SMTP 'ehlo' command.
        Hostname to send for this command defaults to the FQDN of the local
        host.
        iiuServer not connectedi�ulatin-1u
uauthuu u((?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?ufeatureNi����(uesmtp_featuresuputcmduehlo_msgulocal_hostnameugetreplyulenucloseuSMTPServerDisconnectedu	ehlo_respu
does_esmtpudecodeusplitu
OLDSTYLE_AUTHumatchugetugroupsureugroupulowerustringuendustrip(
uselfunameucodeumsgurespueachu
auth_matchumufeatureuparams((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuehlo�s2	
	
	
1"'u	SMTP.ehlocCs|j�|jkS(u7Does the server support a given SMTP service extension?(uloweruesmtp_features(uselfuopt((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuhas_extn�su
SMTP.has_extncCs|jd|�|j�dS(u;SMTP 'help' command.
        Returns help text from server.uhelpi(uputcmdugetreply(uselfuargs((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuhelp�su	SMTP.helpcCs
|jd�S(u&SMTP 'rset' command -- resets session.urset(udocmd(uself((u,/opt/alt/python33/lib64/python3.3/smtplib.pyurset�su	SMTP.rsetcCs
|jd�S(u-SMTP 'noop' command -- doesn't do anything :>unoop(udocmd(uself((u,/opt/alt/python33/lib64/python3.3/smtplib.pyunoop�su	SMTP.noopcCsUd}|r+|jr+ddj|�}n|jddt|�|f�|j�S(u0SMTP 'mail' command -- begins mail xfer session.uu umailu	FROM:%s%s(u
does_esmtpujoinuputcmdu	quoteaddrugetreply(uselfusenderuoptionsu
optionlist((u,/opt/alt/python33/lib64/python3.3/smtplib.pyumail�s
 u	SMTP.mailcCsUd}|r+|jr+ddj|�}n|jddt|�|f�|j�S(u;SMTP 'rcpt' command -- indicates 1 recipient for this mail.uu urcptuTO:%s%s(u
does_esmtpujoinuputcmdu	quoteaddrugetreply(uselfurecipuoptionsu
optionlist((u,/opt/alt/python33/lib64/python3.3/smtplib.pyurcpt�s
 u	SMTP.rcptcCs$|jd�|j�\}}|jdkrJtd||fdt�n|dkrht||��n�t|t�r�t|�j	d�}nt
|�}|d
d�tkr�|t}n|d	t}|j|�|j�\}}|jdkrtd||fdt�n||fSdS(u�SMTP 'DATA' command -- sends message data to server.

        Automatically quotes lines beginning with a period per rfc821.
        Raises SMTPDataError if there is an unexpected reply to the
        DATA command; the return value from this method is the final
        response code received when the all data is sent.  If msg
        is a string, lone '
' and '
' characters are converted to
        '
' characters.  If msg is bytes, it is transmitted as is.
        udataiudata:ufileibuasciiiNs.i����(
uputcmdugetreplyu
debugleveluprintustderru
SMTPDataErroru
isinstanceustru	_fix_eolsuencodeu_quote_periodsubCRLFusend(uselfumsgucodeurepluq((u,/opt/alt/python33/lib64/python3.3/smtplib.pyudata�s"



u	SMTP.datacCs |jdt|��|j�S(u5SMTP 'verify' command -- checks for address validity.uvrfy(uputcmdu
_addr_onlyugetreply(uselfuaddress((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuverifysuSMTP.verifycCs |jdt|��|j�S(u.SMTP 'expn' command -- expands a mailing list.uexpn(uputcmdu
_addr_onlyugetreply(uselfuaddress((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuexpnsu	SMTP.expncCs�|jdkr�|jdkr�d|j�dko?dkns�|j�\}}d|komdkns�t||��q�q�ndS(ubCall self.ehlo() and/or self.helo() if needed.

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

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        i�ii+N(u	helo_respuNoneu	ehlo_respuehlouhelou
SMTPHeloError(uselfucodeuresp((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuehlo_or_helo_if_neededs
&uSMTP.ehlo_or_helo_if_neededc
	s�dd�}dd�}d}d}d}|j�|jd�sRtd	��n|jdj��|||g}�fd
d�|D�}	|	s�td��nx2|	D]*}
|
|kr|jd
|�\}}|dkr�|j||||��\}}q�n�|
|kr>|jd
|d|||��\}}n|
|kr�|jd
d|t|jd�dd�f�\}}|dkr�|jt|jd�dd��\}}q�n|dkr�||fSq�Wt||��dS(uALog in on an SMTP server that requires authentication.

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

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

        This method will return normally if the authentication was successful.

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
         SMTPAuthenticationError  The server didn't accept the username/
                                  password combination.
         SMTPException            No suitable authentication method was
                                  found.
        cSsQtj|�}|dtj|jd�|�j�}t|jd�dd�S(Nu uasciiueolu(ubase64udecodebytesuhmacuHMACuencodeu	hexdigestu
encode_base64(u	challengeuuserupassworduresponse((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuencode_cram_md5Fsu#SMTP.login.<locals>.encode_cram_md5cSs)d||f}t|jd�dd�S(Nu%s%suasciiueolu(u
encode_base64uencode(uuserupasswordus((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuencode_plainLsu SMTP.login.<locals>.encode_plainuPLAINuCRAM-MD5uLOGINuauthu,SMTP AUTH extension not supported by server.cs"g|]}|�kr|�qS(((u.0uauth(uadvertised_authlist(u,/opt/alt/python33/lib64/python3.3/smtplib.pyu
<listcomp>cs	uSMTP.login.<locals>.<listcomp>u(No suitable authentication method found.uAUTHiNu u%s %suasciiueolui�i�N(i�i�(	uehlo_or_helo_if_neededuhas_extnu
SMTPExceptionuesmtp_featuresusplitudocmdu
encode_base64uencodeuSMTPAuthenticationError(
uselfuuserupassworduencode_cram_md5uencode_plainu
AUTH_PLAINu
AUTH_CRAM_MD5u
AUTH_LOGINupreferred_authsuauthlistu
authmethoducodeuresp((uadvertised_authlistu,/opt/alt/python33/lib64/python3.3/smtplib.pyulogin0s:

'	#	.0u
SMTP.logincCs4|j�|jd�s(td��n|jd�\}}|dkrts^td��n|d	k	r�|d	k	r�td��n|d	k	r�|d	k	r�td��n|d	k	r�|j|j	�|_	nt
j|j	||�|_	d	|_d	|_d	|_
i|_d|_nt||��||fS(
u�Puts the connection to the SMTP server into TLS mode.

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

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

        This method may raise the following exceptions:

         SMTPHeloError            The server didn't reply properly to
                                  the helo greeting.
        ustarttlsu+STARTTLS extension not supported by server.uSTARTTLSi�u&No SSL support included in this Pythonu4context and keyfile arguments are mutually exclusiveu5context and certfile arguments are mutually exclusiveiN(uehlo_or_helo_if_neededuhas_extnu
SMTPExceptionudocmdu	_have_ssluRuntimeErroruNoneu
ValueErroruwrap_socketusockusslufileu	helo_respu	ehlo_respuesmtp_featuresu
does_esmtpuSMTPResponseException(uselfukeyfileucertfileucontexturespureply((u,/opt/alt/python33/lib64/python3.3/smtplib.pyustarttls�s*
				u
SMTP.starttlscCs|j�g}t|t�r7t|�jd�}n|jr�|jd�ri|jdt|��nx|D]}|j|�qpWn|j	||�\}}	|dkr�|dkr�|j
�n
|j�t||	|��ni}
t|t�r|g}nxv|D]n}|j
||�\}}	|dkrW|dkrW||	f|
|<n|dkr|j
�t|
��qqWt|
�t|�kr�|j�t|
��n|j|�\}}	|dkr|dkr�|j
�n
|j�t||	��n|
S(u�
This command performs an entire mail transaction.

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

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

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

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

        This method may raise the following exceptions:

         SMTPHeloError          The server didn't reply properly to
                                the helo greeting.
         SMTPRecipientsRefused  The server rejected ALL recipients
                                (no mail was sent).
         SMTPSenderRefused      The server didn't accept the from_addr.
         SMTPDataError          The server replied with an unexpected
                                error code (other than a refusal of
                                a recipient).

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

        Example:

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

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

        uasciiusizeusize=%di�i�i�(uehlo_or_helo_if_neededu
isinstanceustru	_fix_eolsuencodeu
does_esmtpuhas_extnuappendulenumailucloseursetuSMTPSenderRefusedurcptuSMTPRecipientsRefusedudatau
SMTPDataError(uselfu	from_addruto_addrsumsgumail_optionsurcpt_optionsu
esmtp_optsuoptionucodeurespusenderrsueach((u,/opt/alt/python33/lib64/python3.3/smtplib.pyusendmail�sF=
	







u
SMTP.sendmailc
Csd|jd�}|dkr$d}n't|�dkr?d}ntd��|dkr�|d|kru||dn||d}n|dkr�dd	�||d
||d||dfD�}d
d	�tjj|�D�}ntj|�}	|	d=|	d=tj	��8}
tj
j|
�}|j|	dd�|
j
�}WdQX|j|||||�S(u�Converts message to a bytestring and passes it to sendmail.

        The arguments are as for sendmail, except that msg is an
        email.message.Message object.  If from_addr is None or to_addrs is
        None, these arguments are taken from the headers of the Message as
        described in RFC 2822 (a ValueError is raised if there is more than
        one set of 'Resent-' headers).  Regardless of the values of from_addr and
        to_addr, any Bcc field (or Resent-Bcc field, when the Message is a
        resent) of the Message object won't be transmitted.  The Message
        object is then serialized using email.generator.BytesGenerator and
        sendmail is called to transmit the message.

        uResent-DateuiuResent-u0message has more than one 'Resent-' header blockuSenderuFromcSs"g|]}|dk	r|�qS(N(uNone(u.0uf((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu
<listcomp>?s	u%SMTP.send_message.<locals>.<listcomp>uTouBccuCccSsg|]}|d�qS(i((u.0ua((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu
<listcomp>Bs	u
Resent-Bcculinesepu
N(uget_alluNoneulenu
ValueErroruemailuutilsugetaddressesucopyuiouBytesIOu	generatoruBytesGeneratoruflattenugetvalueusendmail(
uselfumsgu	from_addruto_addrsumail_optionsurcpt_optionsuresentu
header_prefixuaddr_fieldsumsg_copyubytesmsguguflatmsg((u,/opt/alt/python33/lib64/python3.3/smtplib.pyusend_messages.		"uSMTP.send_messagecCsH|jr|jj�nd|_|jr;|jj�nd|_dS(u(Close the connection to the SMTP server.N(ufileucloseuNoneusock(uself((u,/opt/alt/python33/lib64/python3.3/smtplib.pyucloseNs			u
SMTP.closecCs|jd�}|j�|S(uTerminate the SMTP session.uquit(udocmduclose(uselfures((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuquitWs
u	SMTP.quitN(,u__name__u
__module__u__qualname__u__doc__u
debugleveluNoneufileu	helo_respuehlo_msgu	ehlo_respu
does_esmtpu	SMTP_PORTudefault_portusocketu_GLOBAL_DEFAULT_TIMEOUTu__init__u	__enter__u__exit__uset_debuglevelu_get_socketuconnectusenduputcmdugetreplyudocmduhelouehlouhas_extnuhelpursetunoopumailurcptudatauverifyuvrfyuexpnuehlo_or_helo_if_neededuloginustarttlsusendmailusend_messageucloseuquit(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuSMTP�sR	*
		"1
3P2f4	c
BsS|EeZdZdZeZdddddejdddd�Z	dd�Z
dS(	uSMTP_SSLu� This is a subclass derived from SMTP that connects over an SSL
        encrypted socket (to use this class you need a socket module that was
        compiled with SSL support). If host is not specified, '' (the local
        host) is used. If port is omitted, the standard SMTP-over-SSL port
        (465) is used.  local_hostname and source_address have the same meaning
        as they do in the SMTP class.  keyfile and certfile are also optional -
        they can contain a PEM formatted private key and certificate chain file
        for the SSL connection. context also optional, can contain a
        SSLContext, and is an alternative to keyfile and certfile; If it is
        specified both keyfile and certfile must be None.

        uic			Cs�|dk	r'|dk	r'td��n|dk	rN|dk	rNtd��n||_||_||_tj||||||�dS(Nu4context and keyfile arguments are mutually exclusiveu5context and certfile arguments are mutually exclusive(uNoneu
ValueErrorukeyfileucertfileucontextuSMTPu__init__(	uselfuhostuportulocal_hostnameukeyfileucertfileutimeoutusource_addressucontext((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu__init__os			uSMTP_SSL.__init__cCs�|jdkr+td||fdt�ntj||f||j�}|jdk	rm|jj|�}nt	j||j
|j�}|S(Niuconnect:ufile(u
debugleveluprintustderrusocketucreate_connectionusource_addressucontextuNoneuwrap_socketusslukeyfileucertfile(uselfuhostuportutimeoutu
new_socket((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu_get_socketsuSMTP_SSL._get_socketN(u__name__u
__module__u__qualname__u__doc__u
SMTP_SSL_PORTudefault_portuNoneusocketu_GLOBAL_DEFAULT_TIMEOUTu__init__u_get_socket(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuSMTP_SSL_s	
uSMTP_SSLi�cBsM|EeZdZdZdZded
d
dd�Zddd
dd	�Zd
S(uLMTPu�LMTP - Local Mail Transfer Protocol

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

    Authentication is supported, using the regular SMTP mechanism. When
    using a Unix socket, LMTP generally don't support or require any
    authentication, but your mileage might vary.ulhloucCs#tj|||d|d|�dS(uInitialize a new instance.ulocal_hostnameusource_addressN(uSMTPu__init__(uselfuhostuportulocal_hostnameusource_address((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu__init__�su
LMTP.__init__u	localhostic
Cs|ddkr)tj|||d|�Sy8tjtjtj�|_d|_|jj|�Wn_tjk
r�|j	dkr�t
d|dt�n|jr�|jj�nd|_�YnX|j
�\}}|j	dkr�t
d|dt�n||fS(u=Connect to the LMTP daemon, on either a Unix or a TCP socket.iu/usource_addressu
connect fail:ufileuconnect:N(uSMTPuconnectusocketuAF_UNIXuSOCK_STREAMusockuNoneufileuerroru
debugleveluprintustderrucloseugetreply(uselfuhostuportusource_addressucodeumsg((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuconnect�s"			uLMTP.connectN(	u__name__u
__module__u__qualname__u__doc__uehlo_msgu	LMTP_PORTuNoneu__init__uconnect(u
__locals__((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuLMTP�s
	uLMTPu__main__cCs4tjj|d�tjj�tjj�j�S(Nu: (usysustdoutuwriteuflushustdinureadlineustrip(uprompt((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuprompt�s
upromptuFromuTou,uEnter message, end with ^D:uuMessage length is %du	localhosti(Au__doc__usocketuioureuemail.utilsuemailu
email.messageuemail.generatorubase64uhmacucopyuemail.base64mimeubody_encodeu
encode_base64usysustderru__all__u	SMTP_PORTu
SMTP_SSL_PORTuCRLFubCRLFu_MAXLINEucompileuIu
OLDSTYLE_AUTHu	Exceptionu
SMTPExceptionuSMTPServerDisconnecteduSMTPResponseExceptionuSMTPSenderRefuseduSMTPRecipientsRefusedu
SMTPDataErroruSMTPConnectErroru
SMTPHeloErroruSMTPAuthenticationErroru	quoteaddru
_addr_onlyu	quotedatau_quote_periodsu	_fix_eolsussluImportErroruFalseu	_have_ssluTrueuSMTPuSMTP_SSLuappendu	LMTP_PORTuLMTPu__name__upromptufromaddrusplitutoaddrsuprintumsgustdinureadlineulineulenuserveruset_debuglevelusendmailuquit(((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu<module>!s�			


	
���+/