ž ¦ÿf…”c @sMdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddlmZddddd d d d d dddg ZdZdZdZdZdZejdejƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd „d eƒZGdd „d eƒZGdd „d eƒ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 ". 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 ") >>> s.quit() iN(u body_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(uu(uemailuutilsu parseaddrustripu startswith(u addrstringu displaynameuaddr((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu quoteaddr‰s cCs2tjj|ƒ\}}||fdkr.|S|S(Nu(uu(uemailuutilsu parseaddr(u addrstringu displaynameuaddr((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 e Z ddd>e jd>dd„Zdd„Zd d „Zd d „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 ƒƒ} Wntj k 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 gethostbynameu gethostnameugaierror( 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(Niu connect: 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 j k 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 u SMTP.putcmdcCsÁg}|jdkr-|jjdƒ|_nxLy|jjtdƒ}WnHtjk r”}z%|jƒt dt |ƒƒ‚WYdd}~XnX|s´|jƒt dƒ‚n|j dkrßt dt |ƒdtƒnt|ƒtkrtd d ƒ‚n|j|d d…jd ƒƒ|dd …}yt|ƒ}Wntk r^d}PYnX|d d …dkr0Pq0q0dj|ƒ}|j dkr·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|_ t |jt ƒs½t t |jƒƒ‚|jjdƒjdƒ}|d=xì|D]ä}tj|ƒ}|r8|jjddƒd |jdƒd|jd[A-Za-z0-9][A-Za-z0-9\-]*) ?ufeatureNiÿÿÿÿ(uesmtp_featuresuputcmduehlo_msgulocal_hostnameugetreplyulenucloseuSMTPServerDisconnectedu ehlo_respu does_esmtpu isinstanceubytesuAssertionErrorureprudecodeusplitu OLDSTYLE_AUTHumatchugetugroupsureugroupulowerustringuendustrip( uselfunameucodeumsgurespueachu auth_matchumufeatureuparams((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuehloŸs4      ' 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…t kr¾|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.pyuverifysu SMTP.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(ubase64u decodebytesuhmacuHMACuencodeu hexdigestu encode_base64(u challengeuuserupassworduresponse((u,/opt/alt/python33/lib64/python3.3/smtplib.pyuencode_cram_md5Fsu#SMTP.login..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..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 cs uSMTP.login..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 ValueErroru wrap_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| | >> 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. u Resent-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 ?s u%SMTP.send_message..uTouBccuCccSsg|]}|d‘qS(i((u.0ua((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu Bs u Resent-Bcculinesepu N(uget_alluNoneulenu ValueErroruemailuutilsu getaddressesucopyuiouBytesIOu generatoruBytesGeneratoruflattenugetvalueusendmail( uselfumsgu from_addruto_addrsu mail_optionsu rcpt_optionsuresentu header_prefixu addr_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_addressucontextuNoneu wrap_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_UNIXu SOCK_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__usocketuioureu email.utilsuemailu email.messageuemail.generatorubase64uhmacucopyuemail.base64mimeu body_encodeu encode_base64usysustderru__all__u SMTP_PORTu SMTP_SSL_PORTuCRLFubCRLFu_MAXLINEucompileuIu OLDSTYLE_AUTHu Exceptionu SMTPExceptionuSMTPServerDisconnecteduSMTPResponseExceptionuSMTPSenderRefuseduSMTPRecipientsRefusedu SMTPDataErroruSMTPConnectErroru SMTPHeloErroruSMTPAuthenticationErroru quoteaddru _addr_onlyu quotedatau_quote_periodsu _fix_eolsusslu ImportErroruFalseu _have_ssluTrueuSMTPuSMTP_SSLuappendu LMTP_PORTuLMTPu__name__upromptufromaddrusplitutoaddrsuprintumsgustdinureadlineulineulenuserveruset_debuglevelusendmailuquit(((u,/opt/alt/python33/lib64/python3.3/smtplib.pyu!s‚                   ÿÿª+/