Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.135.193.59
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : smtplib.cpython-32.pyo
l
��bc@s'dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZ
ddlmZddddd	d
ddd
dddgZdZdZdZdZdZejdej�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�d	e�ZGd�d
e�ZGd�de�Z Gd�de�Z!Gd�d
e�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'yddl(Z(Wne)k
r�e*Z+YnXGd%�d&�Z,e-Z+Gd'�d�Z.e+rAGd(�d)e.�Z/ej0d)�nd*Z1Gd+�d,e.�Z2e3d-kr#ddlZd.�Z4e4d/�Z5e4d0�j6d1�Z7e8d2�d3Z9x'ej:j;�Z<e<r�Pne9e<Z9q�e8d4e=e9��e.d5�Z>e>j?d6�e>j@e5e7e9�e>jA�ndS(7uSMTP/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|EeZdZdS(u4Base class for all exceptions raised by this module.N(u__name__u
__module__u__doc__(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu
SMTPExceptionFs
cBs|EeZdZdS(u�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__doc__(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuSMTPServerDisconnectedIs
cBs|EeZdZd�ZdS(u2Base 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./usr/local/python-3.2/lib/python3.2/smtplib.pyu__init__Zs		N(u__name__u
__module__u__doc__u__init__(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuSMTPResponseExceptionQs
cBs|EeZdZd�ZdS(u�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./usr/local/python-3.2/lib/python3.2/smtplib.pyu__init__fs			N(u__name__u
__module__u__doc__u__init__(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuSMTPSenderRefused_s
cBs|EeZdZd�ZdS(u�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./usr/local/python-3.2/lib/python3.2/smtplib.pyu__init__ts	N(u__name__u
__module__u__doc__u__init__(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuSMTPRecipientsRefusedls
cBs|EeZdZdS(u'The SMTP server didn't accept the data.N(u__name__u
__module__u__doc__(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu
SMTPDataErrorys
cBs|EeZdZdS(u&Error during connection establishment.N(u__name__u
__module__u__doc__(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuSMTPConnectError|s
cBs|EeZdZdS(u"The server refused our HELO reply.N(u__name__u
__module__u__doc__(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu
SMTPHeloErrors
cBs|EeZdZdS(uvAuthentication error.

    Most probably the server didn't accept the username/password
    combination provided.
    N(u__name__u
__module__u__doc__(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuSMTPAuthenticationError�s
cCsed}ytjj|�d}Wntk
r4YnX|dkrId|S|dkrYdSd|SdS(u�Quote a subset of the email addresses defined by RFC 821.

    Should be able to handle anything email.utils.parseaddr can handle.
    iu<%s>u<>N(NN(NN(uNoneuemailuutilsu	parseaddruAttributeError(uaddrum((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu	quoteaddr�s
cCs2tjj|�\}}||fdkr.|S|S(Nu(uu(uemailuutilsu	parseaddr(u
addrstringudisplaynameuaddr((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu
_addr_only�scCs"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./usr/local/python-3.2/lib/python3.2/smtplib.pyu	quotedata�scCstjdd|�S(Ns(?m)^\.s..(ureusub(ubindata((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu_quote_periods�scCstjdt|�S(Nu(?:\r\n|\n|\r(?!\n))(ureusubuCRLF(udata((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu	_fix_eols�scBs2|EeZdZd�Zdd�Zd�ZdS(utA fake file like object that really wraps a SSLObject.

        It only supports what is needed in smtplib.
        cCs
||_dS(N(usslobj(uselfusslobj((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu__init__�sicCs�|dkrd}nd}d}xX|dkr{|dk	rRt|�|krRPn|jjd�}|snPn||7}q$W|S(Niss
i(uNoneulenusslobjuread(uselfusizeustruchr((u./usr/local/python-3.2/lib/python3.2/smtplib.pyureadline�s	cCsdS(N((uself((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuclose�sNi����(u__name__u
__module__u__doc__u__init__ureadlineuclose(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuSSLFakeFile�s
	uSSLFakeFilecBsp|EeZdZdZdZdZdZdZdZ	e
Zdddej
d�Zd�Zd�Zddd�Zd	�Zdd
�Zd�Zdd�Zdd
�Zdd�Zd�Zdd�Zd�Zd�Zgd�Zgd�Zd�Zd�ZeZ d�Z!d�Z"d�Z#ddd�Z$ggd�Z%ddgid�Z&d�Z'd�Z(dS( u�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|_|rQ|j||�\}}|dkrQt||��qQn|dk	ri||_nhtj�}d|kr�||_nDd}ytjtj	��}Wntj
k
r�YnXd||_dS(u�Initialize 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.  An SMTPConnectError is raised
        if the specified `host' doesn't respond correctly.  If specified,
        `local_hostname` is used as the FQDN of the local host.  By default,
        the local hostname is found using socket.getfqdn().

        i�u.u	127.0.0.1u[%s]N(utimeoutuesmtp_featuresuconnectuSMTPConnectErroruNoneulocal_hostnameusocketugetfqdnu
gethostbynameugethostnameugaierror(	uselfuhostuportulocal_hostnameutimeoutucodeumsgufqdnuaddr((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu__init__�s"		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./usr/local/python-3.2/lib/python3.2/smtplib.pyuset_debuglevelscCsA|jdkr+td||fdt�ntj||f|�S(Niuconnect:ufile(u
debugleveluprintustderrusocketucreate_connection(uselfuhostuportutimeout((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu_get_socket&su	localhostcCs8|r�|jd�|jd�kr�|jd�}|dkr�|d|�||dd�}}yt|�}Wq�tk
r�tjd��Yq�Xq�n|s�|j}n|jdkr�td||fdt	�n|j
|||j�|_|j
�\}}|jdkr.td|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(ufindurfinduintu
ValueErrorusocketuerrorudefault_portu
debugleveluprintustderru_get_socketutimeoutusockugetreply(uselfuhostuportuiucodeumsg((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuconnect-s"%%
c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./usr/local/python-3.2/lib/python3.2/smtplib.pyusendJs
cCsC|dkrd|tf}nd||tf}|j|�dS(uSend a command to the server.uu%s%su%s %s%sN(uCRLFusend(uselfucmduargsustr((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuputcmdYscCs�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./usr/local/python-3.2/lib/python3.2/smtplib.pyugetreplyas<

#
 
cCs|j||�|j�S(u-Send a command, and return its response code.(uputcmdugetreply(uselfucmduargs((u./usr/local/python-3.2/lib/python3.2/smtplib.pyudocmd�scCs>|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./usr/local/python-3.2/lib/python3.2/smtplib.pyuhelo�s	c
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./usr/local/python-3.2/lib/python3.2/smtplib.pyuehlo�s2	
	
	
1"'cCs|j�|jkS(u7Does the server support a given SMTP service extension?(uloweruesmtp_features(uselfuopt((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuhas_extn�scCs|jd|�|j�dS(u;SMTP 'help' command.
        Returns help text from server.uhelpi(uputcmdugetreply(uselfuargs((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuhelp�scCs
|jd�S(u&SMTP 'rset' command -- resets session.urset(udocmd(uself((u./usr/local/python-3.2/lib/python3.2/smtplib.pyurset�scCs
|jd�S(u-SMTP 'noop' command -- doesn't do anything :>unoop(udocmd(uself((u./usr/local/python-3.2/lib/python3.2/smtplib.pyunoop�scCsUd}|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./usr/local/python-3.2/lib/python3.2/smtplib.pyumail�s
 cCsUd}|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./usr/local/python-3.2/lib/python3.2/smtplib.pyurcpt�s
 cCs$|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./usr/local/python-3.2/lib/python3.2/smtplib.pyudata�s"



cCs |jdt|��|j�S(u5SMTP 'verify' command -- checks for address validity.uvrfy(uputcmdu
_addr_onlyugetreply(uselfuaddress((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuverifyscCs |jdt|��|j�S(u.SMTP 'expn' command -- expands a mailing list.uexpn(uputcmdu
_addr_onlyugetreply(uselfuaddress((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuexpnscCs�|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./usr/local/python-3.2/lib/python3.2/smtplib.pyuehlo_or_helo_if_needed!s
&c
	s�d�}d�}d}d}d}|j�|jd�sLtd��n|jdj��|||g}�fd�|D�}	|	s�td	��nx2|	D]*}
|
|kr�|jd
|�\}}|dkr�|j||||��\}}q�n�|
|kr5|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./usr/local/python-3.2/lib/python3.2/smtplib.pyuencode_cram_md5HscSs)d||f}t|jd�dd�S(Nu%s%suasciiueolu(u
encode_base64uencode(uuserupasswordus((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuencode_plainNsuPLAINuCRAM-MD5uLOGINuauthu,SMTP AUTH extension not supported by server.cs"g|]}|�kr|�qS(((u.0uauth(uadvertised_authlist(u./usr/local/python-3.2/lib/python3.2/smtplib.pyu
<listcomp>es	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./usr/local/python-3.2/lib/python3.2/smtplib.pyulogin2s:		

'	#	.0cCs�|j�|jd�s(td��n|jd�\}}|dkr�ts^td��ntj|j||�|_t	|j�|_
d|_d|_
i|_d|_n||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 PythoniN(uehlo_or_helo_if_neededuhas_extnu
SMTPExceptionudocmdu	_have_ssluRuntimeErrorussluwrap_socketusockuSSLFakeFileufileuNoneu	helo_respu	ehlo_respuesmtp_featuresu
does_esmtp(uselfukeyfileucertfileurespureply((u./usr/local/python-3.2/lib/python3.2/smtplib.pyustarttls�s
			c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./usr/local/python-3.2/lib/python3.2/smtplib.pyusendmail�sF=
	







c
Cs^|jd�}|dkr$d}n't|�dkr?d}ntd��|dkr�|d|kru||dn||d}n|dkr�d�||d	||d
||dfD�}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./usr/local/python-3.2/lib/python3.2/smtplib.pyu
<listcomp>2s	uTouBccuCccSsg|]}|d�qS(i((u.0ua((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu
<listcomp>5s	u
Resent-Bcculinesepu
N(uget_alluNoneulenu
ValueErroruemailuutilsugetaddressesucopyuiouBytesIOu	generatoruBytesGeneratoruflattenugetvalueusendmail(
uselfumsgu	from_addruto_addrsumail_optionsurcpt_optionsuresentu
header_prefixuaddr_fieldsumsg_copyubytesmsguguflatmsg((u./usr/local/python-3.2/lib/python3.2/smtplib.pyusend_message
s.		cCsH|jr|jj�nd|_|jr;|jj�nd|_dS(u(Close the connection to the SMTP server.N(ufileucloseuNoneusock(uself((u./usr/local/python-3.2/lib/python3.2/smtplib.pyucloseAs			cCs|jd�}|j�|S(uTerminate the SMTP session.uquit(udocmduclose(uselfures((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuquitJs
N()u__name__u
__module__u__doc__u
debugleveluNoneufileu	helo_respuehlo_msgu	ehlo_respu
does_esmtpu	SMTP_PORTudefault_portusocketu_GLOBAL_DEFAULT_TIMEOUTu__init__uset_debuglevelu_get_socketuconnectusenduputcmdugetreplyudocmduhelouehlouhas_extnuhelpursetunoopumailurcptudatauverifyuvrfyuexpnuehlo_or_helo_if_neededuloginustarttlsusendmailusend_messageucloseuquit(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuSMTP�sL
	#					0
3								P$f3		cBsA|EeZdZeZdddddejd�Zd�Z	dS(u� 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. keyfile and certfile
        are also optional - they can contain a PEM formatted private key and
        certificate chain file for the SSL connection.
        uicCs/||_||_tj|||||�dS(N(ukeyfileucertfileuSMTPu__init__(uselfuhostuportulocal_hostnameukeyfileucertfileutimeout((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu__init__]s		cCsq|jdkr+td||fdt�ntj||f|�}tj||j|j�}t	|�|_
|S(Niuconnect:ufile(u
debugleveluprintustderrusocketucreate_connectionussluwrap_socketukeyfileucertfileuSSLFakeFileufile(uselfuhostuportutimeoutu
new_socket((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu_get_socketdsN(
u__name__u
__module__u__doc__u
SMTP_SSL_PORTudefault_portuNoneusocketu_GLOBAL_DEFAULT_TIMEOUTu__init__u_get_socket(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuSMTP_SSLRs
	uSMTP_SSLi�cBs;|EeZdZdZdedd�Zddd�ZdS(u-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. 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.ulhloucCstj||||�dS(uInitialize a new instance.N(uSMTPu__init__(uselfuhostuportulocal_hostname((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu__init__�su	localhostic
Cs�|ddkr#tj|||�Sy/tjtjtj�|_|jj|�Wn_tjk
r�|jdkr�td|dt	�n|jr�|jj
�nd|_�YnX|j�\}}|jdkr�td|dt	�n||fS(u=Connect to the LMTP daemon, on either a Unix or a TCP socket.iu/u
connect fail:ufileuconnect:N(
uSMTPuconnectusocketuAF_UNIXuSOCK_STREAMusockuerroru
debugleveluprintustderrucloseuNoneugetreply(uselfuhostuportucodeumsg((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuconnect�s 		N(u__name__u
__module__u__doc__uehlo_msgu	LMTP_PORTuNoneu__init__uconnect(u
__locals__((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuLMTPss
uLMTPu__main__cCs4tjj|d�tjj�tjj�j�S(Nu: (usysustdoutuwriteuflushustdinureadlineustrip(uprompt((u./usr/local/python-3.2/lib/python3.2/smtplib.pyuprompt�s
uFromuTou,uEnter message, end with ^D:uuMessage length is %du	localhosti(Bu__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_ssluSSLFakeFileuTrueuSMTPuSMTP_SSLuappendu	LMTP_PORTuLMTPu__name__upromptufromaddrusplitutoaddrsuprintumsgustdinureadlineulineulenuserveruset_debuglevelusendmailuquit(((u./usr/local/python-3.2/lib/python3.2/smtplib.pyu<module>!s�			

						
��~+	



© 2025 GrazzMean