PNG  IHDR* pHYs+ IDATx]n#; cdLb Ǚ[at¤_:uP}>!Usă cag޿ ֵNu`ݼTâabO7uL&y^wFٝA"l[|ŲHLN밪4*sG3|Dv}?+y߉{OuOAt4Jj.u]Gz*҉sP'VQKbA1u\`& Af;HWj hsO;ogTu uj7S3/QzUr&wS`M$X_L7r2;aE+ώ%vikDA:dR+%KzƉo>eOth$z%: :{WwaQ:wz%4foɹE[9<]#ERINƻv溂E%P1i01 |Jvҗ&{b?9g=^wζXn/lK::90KwrюO\!ջ3uzuGv^;騢wq<Iatv09:tt~hEG`v;3@MNZD.1]L:{ծI3`L(÷ba")Y.iljCɄae#I"1 `3*Bdz>j<fU40⨬%O$3cGt]j%Fߠ_twJ;ABU8vP3uEԑwQ V:h%))LfraqX-ۿX]v-\9I gl8tzX ]ecm)-cgʒ#Uw=Wlێn(0hPP/ӨtQ“&J35 $=]r1{tLuǮ*i0_;NƝ8;-vݏr8+U-kruȕYr0RnC]*ެ(M:]gE;{]tg(#ZJ9y>utRDRMdr9㪩̞zֹb<ģ&wzJM"iI( .ꮅX)Qw:9,i좜\Ԛi7&N0:asϓc];=ΗOӣ APqz93 y $)A*kVHZwBƺnWNaby>XMN*45~ղM6Nvm;A=jֲ.~1}(9`KJ/V F9[=`~[;sRuk]rєT!)iQO)Y$V ی ۤmzWz5IM Zb )ˆC`6 rRa}qNmUfDsWuˤV{ Pݝ'=Kֳbg,UҘVz2ﴻnjNgBb{? ߮tcsͻQuxVCIY۠:(V뺕 ٥2;t`@Fo{Z9`;]wMzU~%UA蛚dI vGq\r82iu +St`cR.6U/M9IENDB`3 i: @sldZddlZddlZddlZyddlZdZWnek rDdZYnXddgZGdddeZ dZ d Z d Z d Z e e Zd ZGd ddZerGdddeZejdedkrhddlZeejdZeejejejdejejdejej\ZZxXededD]FZ ej!e \Z"Z#Z$ede xe#D]Z%ede%qd5d6Z#d7d8Z$d9d:Z%d?d;d<Z&dS)@raPThis class supports both the minimal and optional command sets. Arguments can be strings or integers (where appropriate) (e.g.: retr(1) and retr('1') both work equally well. Minimal Command Set: USER name user(name) PASS string pass_(string) STAT stat() LIST [msg] list(msg = None) RETR msg retr(msg) DELE msg dele(msg) NOOP noop() RSET rset() QUIT quit() Optional Commands (some servers support these): RPOP name rpop(name) APOP name digest apop(name, digest) TOP msg n top(msg, n) UIDL [msg] uidl(msg = None) CAPA capa() STLS stls() UTF8 utf8() Raises one exception: 'error_proto'. Instantiate with: POP3(hostname, port=110) NB: the POP protocol locks the mailbox from user authorization until QUIT, so be sure to get in, suck the messages, and quit, each time you access the mailbox. POP is a line-based protocol, which means large mail messages consume lots of python cycles reading them line-by-line. If it's available on your mail server, use IMAP4 instead, it doesn't suffer from the two problems above. zUTF-8cCs@||_||_d|_|j||_|jjd|_d|_|j|_ dS)NFrbr) hostport_tls_established_create_socketsockmakefilefile _debugging_getrespwelcome)selfr rtimeoutrrr__init__as z POP3.__init__cCstj|j|jf|S)N)socketZcreate_connectionr r)rrrrrrkszPOP3._create_socketcCs,|jdkrtdt||jj|tdS)Nz*put*)rprintreprrZsendallCRLF)rlinerrr_putlinens z POP3._putlinecCsB|jrtdt|t||j}tjd|r4td|j|dS)Nz*cmd*s[-]z*Control characters not allowed in commands) rrrbytesencodingresearch ValueErrorr )rrrrr_putcmdus   z POP3._putcmdcCs|jjtd}t|tkr$td|jdkr)cCs\t||j}|jj|j}|s&tdddl}|jd|}|j|j }|j d||fS)a Authorisation - only possible if server has supplied a timestamp in initial greeting. Args: user - mailbox user; password - mailbox password. NB: mailbox is locked by server from here to 'quit()' z!-ERR APOP not supported by serverrNrz APOP %s %s) r!r" timestampmatchrrhashlibgroupZmd5Z hexdigestr8)rr=ZpasswordZsecretmrPZdigestrrrapop;s z POP3.apopcCs|jd||fS)zRetrieve message header of message number 'which' and first 'howmuch' lines of message body. Result is in form ['response', ['line', ...], octets]. z TOP %s %s)r9)rrBZhowmuchrrrtopPszPOP3.topcCs |dk r|jd|S|jdS)zReturn message digest (unique id) list. If 'which', result contains unique id for that message in the form 'response mesgnum uid', otherwise result is the list ['response', ['mesgnum uid', ...], octets] NzUIDL %sZUIDL)r8r9)rrBrrruidlYsz POP3.uidlcCs |jdS)zITry to enter UTF-8 mode (see RFC 6856). Returns server response. ZUTF8)r8)rrrrutf8esz POP3.utf8c Cstdd}i}y8|jd}|d}x |D]}||\}}|||<q&WWn*tk rn}ztdWYdd}~XnX|S)aReturn server capabilities (RFC 2449) as a dictionary >>> c=poplib.POP3('localhost') >>> c.capa() {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'], 'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [], 'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [], 'UIDL': [], 'RESP-CODES': []} >>> Really, according to RFC 2449, the cyrus folks should avoid having the implementation split into multiple arguments... cSs"|jdj}|d|ddfS)Nasciirr)decoder?)rZlstrrr _parsecapxszPOP3.capa.._parsecapZCAPArz!-ERR CAPA not supported by serverN)r9r) rrYcapsr2ZrawcapsZcaplineZcapnmZcapargsZ_errrrrcapaks    z POP3.capacCsxts td|jrtd|j}d|kr2td|dkrBtj}|jd}|j|j|j d|_|jj d|_ d|_|S) z{Start a TLS session on the active connection as specified in RFC 2595. context - a ssl.SSLContext z-ERR TLS support missingz$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by serverN)server_hostnamer T) HAVE_SSLrrr[ssl_create_stdlib_contextr8 wrap_socketrr rr)rcontextrZr2rrrstlss  z POP3.stls)N)N)N)'rrr__doc__r" POP3_PORTr_GLOBAL_DEFAULT_TIMEOUTrrr r&r/rr7r8r9r:r<r=r>rAr6rCrDrErFrHrGrMr#compilerNrSrTrUrVr[rbrrrrr2s@+       c@s8eZdZdZeddejdfddZddZd ddZ dS) POP3_SSLaPOP3 client class over SSL connection Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None, context=None) hostname - the hostname of the pop3 over ssl server port - port number keyfile - PEM formatted file that contains your private key certfile - PEM formatted certificate chain file context - a ssl.SSLContext See the methods of the parent class POP3 for more documentation. NcCs|dk r|dk rtd|dk r0|dk r0td|dk s@|dk rVddl}|jdtd||_||_|dkrxtj||d}||_t j ||||dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr')certfilekeyfile) r%warningswarnDeprecationWarningrirhr^r_rarr)rr rrirhrrarjrrrrszPOP3_SSL.__init__cCs"tj||}|jj||jd}|S)N)r\)rrrar`r )rrrrrrrs  zPOP3_SSL._create_socketcCs tddS)zThe method unconditionally raises an exception since the STLS command doesn't make any sense on an already established SSL/TLS session. z$-ERR TLS session already establishedN)r)rrirhrarrrrbsz POP3_SSL.stls)NNN) rrrrc POP3_SSL_PORTrrerrrbrrrrrgs  rg__main__rr'z Message %d:z z-----------------------)'rcrJr#rr^r] ImportError__all__ Exceptionrrdrmr-ZLFrr+rrgr5rsysargvarr:r=r>r6rAZnumMsgsZ totalSizerangeirCheadermsgr.rrHrrrrsJ  n0