grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026î   f;˜ã @sNdZddlZddlZddlZddlZddlZddlZddlZddl 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 rd(Z*YnXd)Z*Gd*d„dƒZ+e*raGd+d,„d,e+ƒZ,ej-d,ƒnd-Z.Gd.d/„d/e+ƒZ/e0d0krJddlZd1d2„Z1e1d3ƒZ2e1d4ƒj3d5ƒZ4e5d6ƒd7Z6x(ej7j8ƒZ9e9 rïPne6e9Z6qÕWe5d8e:e6ƒƒe+d9ƒZ;e;j<d:ƒe;j=e2e4e6ƒe;j>ƒndS);aSMTP/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() éN)Ú body_encode)ÚstderrÚ SMTPExceptionÚSMTPServerDisconnectedÚSMTPResponseExceptionÚSMTPSenderRefusedÚSMTPRecipientsRefusedÚ SMTPDataErrorÚSMTPConnectErrorÚ SMTPHeloErrorÚSMTPAuthenticationErrorÚ quoteaddrÚ quotedataÚSMTPéiÑz s i z auth=(.*)c@seZdZdZdS)rz4Base class for all exceptions raised by this module.N)Ú__name__Ú __module__Ú __qualname__Ú__doc__©rrú,/opt/alt/python34/lib64/python3.4/smtplib.pyrFs c@seZdZdZdS)rzÌ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)rrrrrrrrrIs c@s"eZdZdZdd„ZdS)ra2Base 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)Ú smtp_codeÚ smtp_errorÚargs)ÚselfÚcodeÚmsgrrrÚ__init__Zs  zSMTPResponseException.__init__N)rrrrrrrrrrQs c@s"eZdZdZdd„ZdS)rz«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)rrÚsenderr)rrrrrrrrfs   zSMTPSenderRefused.__init__N)rrrrrrrrrr_s c@s"eZdZdZdd„ZdS)rzÎ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)Ú recipientsr)rrrrrrts zSMTPRecipientsRefused.__init__N)rrrrrrrrrrls c@seZdZdZdS)r z'The SMTP server didn't accept the data.N)rrrrrrrrr ys c@seZdZdZdS)r z&Error during connection establishment.N)rrrrrrrrr |s c@seZdZdZdS)r z"The server refused our HELO reply.N)rrrrrrrrr s c@seZdZdZdS)r zvAuthentication error. Most probably the server didn't accept the username/password combination provided. N)rrrrrrrrr ‚s cCsStjj|ƒ\}}||fdkrK|jƒjdƒrC|Sd|Sd|S)z‡Quote a subset of the email addresses defined by RFC 821. Should be able to handle anything email.utils.parseaddr can handle. Úú)r r )ÚemailÚutilsÚ parseaddrÚstripÚ startswith)Ú addrstringÚ displaynameÚaddrrrrr ‰s cCs2tjj|ƒ\}}||fdkr.|S|S)Nr )r r )r"r#r$)r'r(r)rrrÚ _addr_only–sr*cCs"tjddtjdt|ƒƒS)z�Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line. z(?m)^\.z..z(?:\r\n|\n|\r(?!\n)))ÚreÚsubÚCRLF)Údatarrrržs cCstjdd|ƒS)Ns(?m)^\.s..)r+r,)ZbindatarrrÚ_quote_periods§sr/cCstjdt|ƒS)Nz(?:\r\n|\n|\r(?!\n)))r+r,r-)r.rrrÚ _fix_eolsªsr0FTc@síeZdZdZdZdZdZdZdZdZ e Z ddde j ddd„Zdd „Zd d „Zd d „Zdd„Zddddd„Zdd„Zddd„Zdd„Zddd„Zddd„Zddd„Zdd „Zdd!d"„Zd#d$„Zd%d&„Zd'd(„Zgd)d*„Zgd+d,„Z d-d.„Z!d/d0„Z"e"Z#d1d2„Z$d3d4„Z%d5d6„Z&dddd7d8„Z'ggd9d:„Z(ddgid;d<„Z)d=d>„Z*d?d@„Z+dS)Ara´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. rNÚehlor c Csç||_||_i|_||_|rc|j||ƒ\}}|dkrct||ƒ‚qcn|dk r{||_nhtjƒ}d|krŸ||_nDd} ytj tj ƒƒ} Wntj k rÕYnXd| |_dS)aInitialize 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. éÜNÚ.z 127.0.0.1z[%s]) Ú_hostÚtimeoutÚesmtp_featuresÚsource_addressÚconnectr Úlocal_hostnameÚsocketZgetfqdnZ gethostbynameZ gethostnameZgaierror) rÚhostÚportr9r5r7rrZfqdnr)rrrrÚs&          z SMTP.__init__cCs|S)Nr)rrrrÚ __enter__szSMTP.__enter__cGsbzPy7|jdƒ\}}|dkr9t||ƒ‚nWntk rNYnXWd|jƒXdS)NZQUITéÝ)ÚdocmdrrÚclose)rrrÚmessagerrrÚ__exit__ s   z SMTP.__exit__cCs ||_dS)z¬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)Ú debuglevel)rrCrrrÚset_debuglevelszSMTP.set_debuglevelcCsM|jdkr1td||f|jdtƒntj||f||jƒS)Nrz connect: toÚfile)rCÚprintr7rr:Úcreate_connection)rr;r<r5rrrÚ _get_sockets  zSMTP._get_socketÚ localhostc CsP|r||_n| r®|jdƒ|jdƒkr®|jdƒ}|dkr®|d|…||dd…}}yt|ƒ}Wq«tk r§tdƒ‚Yq«Xq®n|sÀ|j}n|jdkrëtd||fdt ƒn|j |||j ƒ|_ d|_ |jƒ\}}|jdkrFtd|dt ƒn||fS)apConnect 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. ú:rNéznonnumeric portzconnect:rE)r7ÚfindÚrfindÚintÚ ValueErrorÚOSErrorÚ default_portrCrFrrHr5ÚsockrEÚgetreply)rr;r<r7Úirrrrrr8&s(  % %   z SMTP.connectc Cs¶|jdkr+tdt|ƒdtƒnt|dƒr¦|jr¦t|tƒrd|jdƒ}ny|jj |ƒWq²t k r¢|j ƒt dƒ‚Yq²Xn t dƒ‚dS) zSend `s' to the server.rzsend:rErRÚasciizServer not connectedzplease run connect() firstN) rCrFÚreprrÚhasattrrRÚ isinstanceÚstrÚencodeZsendallrPr@r)rÚsrrrÚsendHs  z SMTP.sendcCsC|dkrd|tf}nd||tf}|j|ƒdS)zSend a command to the server.r z%s%sz%s %s%sN)r-r\)rÚcmdrrYrrrÚputcmdWs z SMTP.putcmdcCsÉg}|jdkr-|jjdƒ|_nxTy|jjtdƒ}WnEtk r‘}z%|jƒtdt|ƒƒ‚WYdd}~XnX|s±|jƒtdƒ‚n|j dkrÜt dt |ƒdt ƒnt |ƒtkr |jƒtd d ƒ‚n|j|d d…jd ƒƒ|dd …}yt|ƒ}Wntk red}PYnX|d d …dkr0Pq0q0Wdj|ƒ}|j dkr¿t d||fdt ƒn||fS)a¨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. NÚrbrKz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:rEiôzLine too long.és éó-s zreply: retcode (%s); Msg: %séÿÿÿÿ)rErRÚmakefileÚreadlineÚ_MAXLINErPr@rrYrCrFrVrÚlenrÚappendr%rNrOÚjoin)rÚrespÚlineÚerZerrcodeÚerrmsgrrrrS_s@  #     z SMTP.getreplycCs|j||ƒ|jƒS)z-Send a command, and return its response code.)r^rS)rr]rrrrr?‘sz SMTP.docmdcCs>|jd|p|jƒ|jƒ\}}||_||fS)zwSMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. Úhelo)r^r9rSÚ helo_resp)rÚnamerrrrrrn—s z 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\-]*) ?ÚfeatureNrc)r6r^Úehlo_msgr9rSrgr@rÚ ehlo_respÚ does_esmtprXÚbytesÚAssertionErrorrVÚdecodeÚsplitÚ OLDSTYLE_AUTHÚmatchÚgetÚgroupsr+ÚgroupÚlowerÚstringÚendr%) rrprrrjÚeachZ auth_matchÚmruZparamsrrrr1¡s4      ' 1" 'z SMTP.ehlocCs|jƒ|jkS)z7Does the server support a given SMTP service extension?)r‚r6)rZoptrrrÚhas_extnÔsz SMTP.has_extncCs|jd|ƒ|jƒdS)z;SMTP 'help' command. Returns help text from server.ÚhelprK)r^rS)rrrrrrˆØsz SMTP.helpcCs |jdƒS)z&SMTP 'rset' command -- resets session.Úrset)r?)rrrrr‰Þsz SMTP.rsetc Cs'y|jƒWntk r"YnXdS)aInternal 'rset' command which ignores any SMTPServerDisconnected error. Used internally in the library, since the server disconnected error should appear to the application when the *next* command is issued, if we are doing an internal "safety" reset. N)r‰r)rrrrÚ_rsetâs z SMTP._rsetcCs |jdƒS)z-SMTP 'noop' command -- doesn't do anything :>Únoop)r?)rrrrr‹îsz SMTP.noopcCsUd}|r+|jr+ddj|ƒ}n|jddt|ƒ|fƒ|jƒS)z0SMTP 'mail' command -- begins mail xfer session.r rtÚmailz FROM:%s%s)rxrir^r rS)rrÚoptionsÚ optionlistrrrrŒòs  z SMTP.mailcCsUd}|r+|jr+ddj|ƒ}n|jddt|ƒ|fƒ|jƒS)z;SMTP 'rcpt' command -- indicates 1 recipient for this mail.r rtÚrcptzTO:%s%s)rxrir^r rS)rZrecipr�rŽrrrr�ús  z 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) aÚ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 '\r' and '\n' characters are converted to '\r\n' characters. If msg is bytes, it is transmitted as is. r.rzdata:rEibrUéNó.éþÿÿÿ) r^rSrCrFrr rXrYr0rZr/ÚbCRLFr\)rrrÚreplÚqrrrr.s"     z SMTP.datacCs |jdt|ƒƒ|jƒS)z5SMTP 'verify' command -- checks for address validity.Úvrfy)r^r*rS)rÚaddressrrrÚverifysz SMTP.verifycCs |jdt|ƒƒ|jƒS)z.SMTP 'expn' command -- expands a mailing list.Úexpn)r^r*rS)rr—rrrr™&sz SMTP.expncCsŽ|jdkrŠ|jdkrŠd|jƒdko?dknsŠ|jƒ\}}d|komdkns‡t||ƒ‚q‡qŠndS)abCall 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. NéÈri+)rorwr1rnr )rrrjrrrÚehlo_or_helo_if_needed-s &zSMTP.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)aALog 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. cSsTtj|ƒ}|dtj|jdƒ|dƒjƒ}t|jdƒddƒS)NrtrUZmd5Úeolr )Úbase64Z decodebytesÚhmacZHMACrZZ hexdigestÚ encode_base64)Z challengeÚuserÚpasswordZresponserrrÚencode_cram_md5Tsz#SMTP.login..encode_cram_md5cSs)d||f}t|jdƒddƒS)NZ%s%srUrœr )rŸrZ)r r¡r[rrrÚ encode_plainZsz SMTP.login..encode_plainZPLAINzCRAM-MD5ZLOGINrsz,SMTP AUTH extension not supported by server.cs"g|]}|ˆkr|‘qSrr)Ú.0rs)Úadvertised_authlistrrú qs zSMTP.login..z(No suitable authentication method found.ZAUTHiNrtz%s %srUrœr éëé÷N)r§r¨) r›r‡rr6r|r?rŸrZr ) rr r¡r¢r£Z AUTH_PLAINZ AUTH_CRAM_MD5Z AUTH_LOGINZpreferred_authsZauthlistZ authmethodrrjr)r¥rÚlogin>s:      '  #  . 0 z SMTP.logincCs:|jƒ|jdƒs(tdƒ‚n|jdƒ\}}|dkr!ts^tdƒ‚n|dk r…|dk r…tdƒ‚n|dk r¬|dk r¬tdƒ‚n|dkrÓtjd |d |ƒ}n|j |j d |j ƒ|_ d|_ d|_ d|_i|_d |_nt||ƒ‚||fS) a¡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. Ústarttlsz+STARTTLS extension not supported by server.ZSTARTTLSr2z&No SSL support included in this PythonNz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiveÚcertfileÚkeyfileÚserver_hostnamer)r›r‡rr?Ú _have_sslÚ RuntimeErrorrOÚsslÚ_create_stdlib_contextÚ wrap_socketrRr4rErorwr6rxr)rr¬r«ÚcontextrjZreplyrrrrªŽs.         z 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. rUÚsizezsize=%drqi¥éû)r›rXrYr0rZrxr‡rhrgrŒr@rŠrr�rr.r ) rÚ from_addrÚto_addrsrÚ mail_optionsÚ rcpt_optionsZ esmtp_optsZoptionrrjZsenderrsr…rrrÚsendmailÁsF=                z SMTP.sendmailc Csd|jdƒ}|dkr$d}n't|ƒdkr?d}n tdƒ‚|dkr†|d|kru||dn ||d}n|dkrèd d „||d ||d ||d fDƒ}dd „tjj|ƒDƒ}ntj|ƒ} | d =| d=tjƒ�8} tj j | ƒ} | j | ddƒ| j ƒ} WdQX|j ||| ||ƒS)aÎ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. z Resent-DateNr rKzResent-z0message has more than one 'Resent-' header blockZSenderÚFromcSs"g|]}|dk r|‘qS)Nr)r¤Úfrrrr¦Ns z%SMTP.send_message..ÚToZBccZCccSsg|]}|d‘qS)rKr)r¤Úarrrr¦Qs z Resent-BccÚlinesepz )Zget_allrgrOr"r#Z getaddressesÚcopyÚioÚBytesIOZ generatorZBytesGeneratorZflattenÚgetvaluerº) rrr¶r·r¸r¹ZresentZ header_prefixZ addr_fieldsZmsg_copyZbytesmsgÚgZflatmsgrrrÚ send_message(s.       "zSMTP.send_messagec CsVz)|j}d|_|r(|jƒnWd|j}d|_|rQ|jƒnXdS)z(Close the connection to the SMTP server.N)rEr@rR)rrErRrrrr@]s    z SMTP.closecCs?|jdƒ}d|_|_i|_d|_|jƒ|S)zTerminate the SMTP session.ÚquitNF)r?rwror6rxr@)rÚresrrrrÆjs    z SMTP.quit),rrrrrCrErorvrwrxÚ SMTP_PORTrQr:Ú_GLOBAL_DEFAULT_TIMEOUTrr=rBrDrHr8r\r^rSr?rnr1r‡rˆr‰rŠr‹rŒr�r.r˜r–r™r›r©rªrºrÅr@rÆrrrrrµsT  +  "  2 3        P3f4 c @sOeZdZdZeZdddddejdddd„Zdd„Z dS) ÚSMTP_SSLaé 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. r rNc Cs°|dk r'|dk r'tdƒ‚n|dk rN|dk rNtdƒ‚n||_||_|dkr‡tjd|d|ƒ}n||_tj||||||ƒdS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiver«r¬)rOr¬r«r°r±r³rr) rr;r<r9r¬r«r5r7r³rrrr†s     zSMTP_SSL.__init__cCsh|jdkr+td||fdtƒntj||f||jƒ}|jj|d|jƒ}|S)Nrzconnect:rEr­) rCrFrr:rGr7r³r²r4)rr;r<r5Z new_socketrrrrH™s  zSMTP_SSL._get_socket) rrrrÚ SMTP_SSL_PORTrQr:rÉrrHrrrrrÊvs  rÊiÓc@sIeZdZdZdZdedddd„Zdddd d „ZdS) ÚLMTPa‰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.Zlhlor NcCs#tj|||d|d|ƒdS)zInitialize a new instance.r9r7N)rr)rr;r<r9r7rrrr¹sz LMTP.__init__rIrc Cs|ddkr)tj|||d|ƒSy8tjtjtjƒ|_d|_|jj|ƒWn\tk r¿|jdkr–t d|dt ƒn|jr¯|jj ƒnd|_‚YnX|j ƒ\}}|jdkr÷t d|dt ƒn||fS)z=Connect to the LMTP daemon, on either a Unix or a TCP socket.rú/r7Nz connect fail:rEzconnect:) rr8r:ZAF_UNIXZ SOCK_STREAMrRrErPrCrFrr@rS)rr;r<r7rrrrrr8¿s"    z LMTP.connect)rrrrrvÚ LMTP_PORTrr8rrrrrÌ©s  rÌÚ__main__cCs4tjj|dƒtjjƒtjjƒjƒS)Nz: )ÚsysÚstdoutÚwriteÚflushÚstdinrer%)ÚpromptrrrrÕÛs rÕr»r½ú,zEnter message, end with ^D:r zMessage length is %drIrK)?rr:rÁr+Z email.utilsr"Z email.messageZemail.generatorr�ržrÀZemail.base64mimerrŸrÐrÚ__all__rÈrËr-r“rfÚcompileÚIr}rPrrrrrr r r r r r*rr/r0r°Ú ImportErrorr®rrÊrhrÎrÌrrÕZfromaddrr|ZtoaddrsrFrrÔrerkrgZserverrDrºrÆrrrrÚ!s‚                   ÿÿÁ,/