e 9SrSSKrSSKrSSKrSSKrSSKrSrSS/r"SS\ 5r Sr S r S r S r\ \-rS r"S S5r\(a"SS\5r\R'S5 \S:Xa\"\R*S5r\"\R155 \R3\R*S5 \R5\R*S5 \R75 \R95urr\"S\S-5H?r \RC\ 5ur"r#r$\"S\ -5 \#Hr%\"S\%-5 M \"S5 MA \RM5 gg!\a SrGNGf=f)z@A POP3 client class. Based on the J. Myers POP3 draft, Jan. 96 NTFPOP3 error_protoc\rSrSrSrg)rN)__name__ __module__ __qualname____firstlineno____static_attributes__r,/opt/imh/python3.13/lib/python3.13/poplib.pyrrsdr ni  ic\rSrSrSrSr\\R4Sjr Sr Sr Sr Sr S rS rS rS rS rSrSrSrSrS#SjrSrSrSrSrSrSrSr\R@"S5r!Sr"Sr#S#Sjr$Sr%S r&S#S!jr'S"r(g)$r3aThis 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-8cXlX lSUl[R"SXU5 UR U5UlUR RS5UlSUl UR5Ul g)NFzpoplib.connectrbr) hostport_tls_establishedsysaudit_create_socketsockmakefilefile _debugging_getrespwelcome)selfrrtimeouts r__init__ POP3.__init__bsa  % "D5''0 II&&t, }} r cUbU(d [S5e[R"URUR4U5$)Nz0Non-blocking socket (timeout=0) is not supported) ValueErrorsocketcreate_connectionrr)r"r#s rrPOP3._create_socketms6  wOP P''DII(>HHr cURS:a[S[U55 [R"SX5 UR R U[-5 g)Nz*put*zpoplib.putline)rprintreprrrrsendallCRLFr"lines r_putline POP3._putliners@ ??Q gtDz : "D/ $+&r cUR(a[S[U55 [XR5nUR U5 g)Nz*cmd*)rr-r.bytesencodingr3r1s r_putcmd POP3._putcmdzs0 ??E'4:6T==) dr cdURR[S-5n[U5[:a [ S5eUR S:a[ S[U55 U(d [ S5e[U5nUSS[:XaUSSU4$USS[:XaUSSU4$USSU4$)Nr,z line too longz*get*z-ERR EOF) rreadline_MAXLINElenrrr-r.r0CR)r"r2octetss r_getline POP3._getlinesyy!!(Q,/ t9x o. . ??Q gtDz :;z22T 9 9f$ $ 8r>":v% %CRy&  r cUR5upURS:a[S[U55 UR S5(d [ U5eU$)Nr,z*resp*+)rBrr-r. startswithr)r"respos rr POP3._getrespsG--/ ??Q hT ;t$$d# # r cUR5n/nSnUR5upEUS:waOURS5(a US- nUSSnX5-nURU5 UR5upEUS:waMOXU4$)Nr.s..r,)r rBrFappend)r"rGlistrAr2rHs r _getlongrespPOP3._getlongresps}}A6--/dlu%%aCABxZF KK mmoGD dl6!!r cDURU5 UR5$N)r8r r1s r _shortcmdPOP3._shortcmds T}}r cDURU5 UR5$rQ)r8rNr1s r_longcmd POP3._longcmds T  ""r cUR$rQ)r!r"s r getwelcomePOP3.getwelcomes ||r cXlgrQ)r)r"levels rset_debuglevelPOP3.set_debuglevelsr c*URSU-5$)zFSend user name, return response (should indicate password required). zUSER %srRr"users rrb POP3.users ~~i$.//r c*URSU-5$)zSend password, return response (response includes message count, mailbox size). NB: mailbox is locked by server from here to 'quit()' zPASS %sr`)r"pswds rpass_ POP3.pass_s~~i$.//r c6URS5nUR5nUR(a[S[ U55 [ U5S:a [ S5e[US5n[US5nX44$![a [ S5ef=f)zMGet mailbox status. Result is tuple of 2 ints (message count, mailbox size) STATz*stat*zInvalid STAT response formatr,z.Invalid STAT response data: non-numeric values) rRsplitrr-r.r?rintr')r"retvalrets numMessages sizeMessagess rstat POP3.stats '||~ ??E(DJ7 t9q=<= = Pd1g,KtAw>)e"34 4}}V$$r c*URSU-5$)z_Retrieve whole message number 'which'. Result is in form ['response', ['line', ...], octets]. zRETR %srUrws rretr POP3.retrs }}Y.//r c*URSU-5$)z6Delete message number 'which'. Result is 'response'. zDELE %sr`rws rdele POP3.dele s ~~i%/00r c$URS5$)zHDoes nothing. One supposes the response indicates the server is alive. NOOPr`rXs rnoop POP3.noops ~~f%%r c$URS5$)z(Unmark all messages marked for deletion.RSETr`rXs rrset POP3.rsets~~f%%r cHURS5nUR5 U$)zDSignoff: commit changes on server, unlock mailbox, close connection.QUIT)rRclose)r"rGs rquit POP3.quit s~~f%  r cURnSUlUbUR5 URnSUlUb1UR[R 5 UR5 gg![ a:nUR[R:wa[USS5S:waeSnANQSnAff=f!UR5 f=f!URnSUlUbUR[R 5 OG![ a:nUR[R:wa[USS5S:waeSnAOSnAff=fUR5 f!UR5 f=ff=f)z8Close the connection without assuming anything about it.Nwinerrorri&') rrrshutdownr( SHUT_RDWROSErrorerrnoENOTCONNgetattr)r"rrexcs rr POP3.close&s) !99DDI 99DDI !MM&"2"23JJL  U^^3"3 A6%? JJL99DDI !MM&"2"23 U^^3"3 A6%? JJLDJJL sp&C A00 B4:0B/*B7/B44B77C  E2$DE E0E>EEE E2E..E2c*URSU-5$)z?Send RPOP command to access the mailbox with an alternate user.zRPOP %sr`ras rrpop POP3.rpopBs~~i$.//r s\+OK.[^<]*(<.*>)c:[X R5nURRUR5nU(d [ S5eSSKnURS5U-nURU5R5nURSU<SU<35$)zAuthorisation - 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 serverrNr,zAPOP  ) r6r7 timestampmatchr!rhashlibgroupmd5 hexdigestrR)r"rbpasswordsecretmrdigests rapop POP3.apopIsyx/ NN  .AB BF"V$..0~~dF;<>)e"34 4}}V$$r c$URS5$)zITry to enter UTF-8 mode (see RFC 6856). Returns server response. UTF8r`rXs rutf8 POP3.utf8ss~~f%%r cSn0nURS5nUSnUHnU"U5upgXrU'M U$![a [S5ef=f)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... cTURS5R5nUSUSS4$)Nasciirr,)decoderl)r2lsts r _parsecapPOP3.capa.._parsecaps-++g&,,.Cq63qr7? "r CAPAr,z!-ERR CAPA not supported by server)rUr)r"rcapsrGrawcapscaplinecapnmcapargss rcapa POP3.capaysn # C==(D1gG"!*7!3%U #   CAB B Cs -6A c[(d [S5eUR(a [S5eUR5nSU;a [S5eUc[R "5nUR S5nURURURS9UlURRS5Ul SUlU$)zcStart a TLS session on the active connection as specified in RFC 2595. context - a ssl.SSLContext z-ERR TLS support missing$-ERR TLS session already establishedSTLSz!-ERR STLS not supported by serverserver_hostnamerT) HAVE_SSLrrrssl_create_stdlib_contextrR wrap_socketrrrr)r"contextrrGs rstls POP3.stlss x89 9  DE Eyy{~AB B ?002G~~f%'' 8< (C II&&t, $ r )rrrrrrr!rQ))rr r r __doc__r7 POP3_PORTr(_GLOBAL_DEFAULT_TIMEOUTr$rr3r8rBr rNrRrUrYr]rbrfrrrMr|rrrrrrrecompilerrrrrrrr rr rrr3s)VH"+77 'I '!* " # 00+0 %01&&  !80  /0I=*= %& :r cR\rSrSrSr\4\RSS.SjjrSr S Sjr Sr g) POP3_SSLiaPOP3 client class over SSL connection Instantiate with: POP3_SSL(hostname, port=995, context=None) hostname - the hostname of the pop3 over ssl server port - port number context - a ssl.SSLContext See the methods of the parent class POP3 for more documentation. N)r#rclUc[R"5nX@l[R XX#5 grQ)rrrrr$)r"rrr#rs rr$POP3_SSL.__init__s(446"L MM$d 4r cx[RX5nURRUURS9nU$)Nr)rrrrr)r"r#rs rrPOP3_SSL._create_sockets:&&t5D<<++D<@II,GDKr c[S5e)zThe method unconditionally raises an exception since the STLS command doesn't make any sense on an already established SSL/TLS session. r)r)r"rs rr POP3_SSL.stlss DE Er )rrQ) rr r r r POP3_SSL_PORTr(rr$rrr rr rrrs, '4 5 & > > 5   Fr r__main__r,rkrjz Message %d:z z-----------------------)'rrrr(rrr ImportError__all__ Exceptionrrrr@LFr0r>rrrLrargvar-rYrbrfrMrrnumMsgs totalSizerangeir|headermsgrAr2rrr rrsy H - #)"      "u vvr  F4F@ NN: z SXXa[A !,,.FF388A;GGCHHQKFFH668Wi 1gk " !q f ma D %$,  '( # FFHq HsEE"!E"