eSrSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK r SSK J r J r J r SSKJr SSKrSr/SQrS rSrS rS rS rS rSr0SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S_S!S_S"S_S#S_S$S_0S%S_S&S_S'S_S(S_S)S_S*S_S+S_S,S_S-S_S.S_S/S_S0S_S1S_S2S_S3S_S4S_S5S_ESSSSSSSSS6.Er\R8"S75r\R8"S85r\R8"S95r\R8"S:\R@5r!\R8"S;5r"\R8"S<5r#\R8"S=5r$\R8"S>\R@5r%S:r&S>r'"S?S@5r(\(a"SASB\(5r)\RUSB5 "SCSD\(5r+"SESF5r,SGR[SH5r.\/"\.SIS5VVs0sHupURa5USI-_M snnr1SJr2SKr3SLr4SMr5\6SN:XGaSSK7r7SSK8r8\7Rn"\RrSISSO5ur:r;Sr>\:H,ur?r=\?SQ:Xa \@"\=5rM\?SR:XdM\=r>\;(aM)\>4r;M. \;(dSSr;\;SrA\8R"5rC\8Rp"ST\C<SU\A=(d SV<SW35rDSX\CSYSZ.-rES[\C\D44S\S]S^S_S`SS\E44SaSbScSdSeSfSgShSi4rFSjSkSlSmS_SSS\E44ShSn4rGSorH\>(a \+"\>5rIO\("\A5rI\IRSp:Xa\FSISrF\IRSq\IR-5 \IRSr\IR<35 \FHurNr;\H"\N\;5 M \H"SsSt5HLrO\R"Su\O5rQ\Q(a\QRSI5rSO\OR[5SvrS\H"Sw\S45 MN \GHGurNr;\H"\N\;5rT\N\;4Sl:waM\TSvR[5rU\U(dM5\H"SxS Sy\USv-Sz45 MI \V"S{5 gg!\a SrGNf=fs snnf!\7Rxar=SPur:r;Sr=C=GN Sr=C=ff=f! \V"S|5 \(d\V"S}\RrS-5 e=f)~zIMAP4 client. Based on RFC 2060. Public class: IMAP4 Public variable: Debug Public functions: Internaldate2tuple Int2AP ParseFlags Time2Internaldate z2.58N)datetimetimezone timedelta)DEFAULT_BUFFER_SIZETF)IMAP4 IMAP4_streamInternaldate2tupleInt2AP ParseFlagsTime2Internaldate i) IMAP4REV1ri@BiAPPEND)AUTHSELECTED AUTHENTICATE)NONAUTH CAPABILITY)rrrLOGOUTCHECK)rCLOSECOPYCREATEDELETE DELETEACLENABLE)rEXAMINEEXPUNGEFETCHGETACL GETANNOTATIONGETQUOTA GETQUOTAROOTMYRIGHTSLISTLOGINrLSUBMOVE NAMESPACENOOPPARTIAL PROXYAUTHRENAMESEARCHSELECTSETACL SETANNOTATIONSETQUOTASORT)STARTTLSSTATUSSTORE SUBSCRIBETHREADUID UNSUBSCRIBEUNSELECTs\+( (?P.*))?s.*FLAGS \((?P[^\)]*)\)s.*INTERNALDATE "(?P[ 0123][0-9])-(?P[A-Z][a-z][a-z])-(?P[0-9][0-9][0-9][0-9]) (?P[0-9][0-9]):(?P[0-9][0-9]):(?P[0-9][0-9]) (?P[-+])(?P[0-9][0-9])(?P[0-9][0-9])"s.*{(?P\d+)}$s \r\n|\r|\ns%\[(?P[A-Z-]+)( (?P.*))?\]s$\* (?P[A-Z-]+)( (?P.*))?s3\* (?P\d+) (?P[A-Z-]+)( (?P.*))?cP\rSrSrSr"SS\5r"SS\5r"SS\5rS \ S 4S jr S r S r Sr SrSrSrSrS \ S 4SjrSrSrSrSrSrSrSrSrSrSrSrSrS rS!r S"r!S#r"S$r#S%r$S&r%S'r&S(r'S)r(S*r)SXS+jr*S,r+S-r,S.r-S/r.SXS0jr/S1r0S2r1S3r2S4r3S5r4S6r5S7r6SYS8jr7S9r8S:r9S;r:S<r;SZS=jrr=S?r>S@r?SAr@SBrASCrBSDrCSErDSFrESGrFSHrGSIrHSJrISKrJS[SLjrKSMrLSNrMSOrNSPrOSQrPSRrQSZSSjrRSTrSSUrTSVrUSWrVg )\raIMAP4 client class. Instantiate with: IMAP4([host[, port[, timeout=None]]]) host - host's name (default: localhost); port - port number (default: standard IMAP4 port). timeout - socket timeout (default: None) If timeout is not given or is None, the global default socket timeout is used All IMAP4rev1 commands are supported by methods of the same name (in lowercase). All arguments to commands are converted to strings, except for AUTHENTICATE, and the last argument to APPEND which is passed as an IMAP4 literal. If necessary (the string contains any non-printing characters or white-space and isn't enclosed with either parentheses or double quotes) each string is quoted. However, the 'password' argument to the LOGIN command is always quoted. If you want to avoid having an argument string quoted (eg: the 'flags' argument to STORE) then enclose the string in parentheses (eg: "(\Deleted)"). Each command returns a tuple: (type, [data, ...]) where 'type' is usually 'OK' or 'NO', and 'data' is either the text from the tagged response, or untagged results from command. Each 'data' is either a string, or a tuple. If a tuple, then the first part is the header of the response, and the second part contains the data (ie: 'literal' value). Errors raise the exception class .error(""). IMAP4 server errors raise .abort(""), which is a sub-class of 'error'. Mailbox status changes from READ-WRITE to READ-ONLY raise the exception class .readonly(""), which is a sub-class of 'abort'. "error" exceptions imply a program error. "abort" exceptions imply the connection should be reset, and the command re-tried. "readonly" exceptions imply the command should be re-tried. Note: to use this module, you must read the RFCs pertaining to the IMAP4 protocol, as the semantics of the arguments to each IMAP4 command are left to the invoker, not to mention the results. Also, most IMAP servers implement a sub-set of the commands available here. c\rSrSrSrg) IMAP4.errorN__name__ __module__ __qualname____firstlineno____static_attributes__rB-/opt/imh/python3.13/lib/python3.13/imaplib.pyerrorr@sDrIrKc\rSrSrSrg) IMAP4.abortrBNrCrBrIrJabortrMsrIrOc\rSrSrSrg)IMAP4.readonlyrBNrCrBrIrJreadonlyrQs4rIrSNcP[UlSUlSUl0Ul0UlSUlSUlSUlSUl UR5 URXU5 UR5 g![a# UR5 e![a ef=ff=f)NrrTFr)Debugdebugstateliteraltagged_commandsuntagged_responsescontinuation_response is_readonlytagnum_tls_established _mode_asciiopen_connect ExceptionshutdownOSErrorselfhostporttimeouts rJ__init__IMAP4.__init__s   !"$%'"  %  $g&  MMO        s0'A88 B%BB% B!B% B!!B%cSUlSUl[R"[[R 5Ul[R"[[R 5Ulg)NFascii) utf8_enabled _encodingrecompile_LiteralASCIILiteral_Untagged_statusUntagged_statusrgs rJr`IMAP4._mode_asciis?! zz(BHH5 !zz*:BHHErIcSUlSUl[R"[5Ul[R"[ 5Ulg)NTutf-8)rorprqrrrsrurvrwrxs rJ _mode_utf8IMAP4._mode_utf8s3  zz(+ !zz*:;rIc"[[R"SS55Ul[R "SUR-S-[R 5UlSUlSUl 0Ul URS:a6URS[-5 URS UR-5 UR5UlS UR ;aS UlO3S UR ;aS UlOUR%UR5eUR'5 URS:aURSUR(<35 [*HnXR(;aMXl g UR%S5e)Niis(?Ps"\d+) (?P[A-Z]+) (?P.*) rzimaplib version %sznew IMAP4 connection, tag=%sPREAUTHrOKrzCAPABILITIES: zserver not IMAP4 compliant)r randomrandinttagprerqrrrttagre _cmd_log_len _cmd_log_idx_cmd_logrW_mesg __version__ _get_responsewelcomer[rXrK_get_capabilities capabilitiesAllowedVersionsPROTOCOL_VERSION)rgversions rJrbIMAP4._connectsIV^^D%89 ZZ ++!&@!ABD((L   "D  !D DMzzQ /+=> 9DKKGH))+ // /DJ T,, ,"DJ**T\\* *  zzQ 1B1BDE&G///$+ !  ' jj566rIcdU[;a[XR55$[SU-5e)NzUnknown IMAP4 command: '%s')CommandsgetattrlowerAttributeError)rgattrs rJ __getattr__IMAP4.__getattr__s, 8 4. .:TABBrIcU$NrBrxs rJ __enter__IMAP4.__enter__s rIchURS:XagUR5 g![a gf=f)Nr)rXlogoutre)rgargss rJ__exit__IMAP4.__exit__s1 :: !   KKM   s $ 11c:UbU(d [S5eUR(dSO URn[R"SXRUR5 X R4nUb[ R "X15$[ R "U5$)Nz0Non-blocking socket (timeout=0) is not supportedz imaplib.open) ValueErrorrhsysauditrisocketcreate_connection)rgrjrhaddresss rJ_create_socketIMAP4._create_socket&su  wOP P99t$)) .$ 499=#  ++G= =''00rIcXlX lURU5UlURR S5Ulg)zSetup connection to remote server on "host:port" (default: localhost:standard IMAP4 port). This connection will be used by the routines: read, readline, send, shutdown. rbN)rhrirsockmakefilefilerfs rJra IMAP4.open3s6   ''0 II&&t, rIc[U[5nURRU5nX!:aT[ U5U:XaE[X!U- 5nX0RRU5- nX$- nX!:a[ U5U:XaMEU$zRead 'size' bytes from remote.)min_SAFE_BUF_SIZErreadlen)rgsizecursizedatadeltas rJr IMAP4.read?stdN+yy~~g&nTg!50E IINN5) )D  GnTg!5 rIcURR[S-5n[U5[:aUR S[-5eU$)Read line from remote.rzgot more than %d bytes)rreadline_MAXLINErrKrglines rJrIMAP4.readlineJs@yy!!(Q,/ t9x **5@A A rIch[R"SX5 URRU5 g)Send data to remote.z imaplib.sendN)rrrsendallrgrs rJsend IMAP4.sendRs" .$- $rIcURR5 URR[R 5 URR5 g![ a:nUR[R:wa[USS5S:waeSnANZSnAff=f!URR5 f=f) Close I/O established in "open".winerrorri&'N) rcloserrdr SHUT_RDWRreerrnoENOTCONNr)rgexcs rJrdIMAP4.shutdownXs   II  v// 0 IIOO   U^^+3 A.%7   IIOO s))A B$*0BB'B$$B''CcUR$)zVReturn socket instance used to connect to IMAP4 server. socket = .socket() )rrxs rJr IMAP4.sockeths yyrIcSnURSS/U5up#US(aX#4$UR5up#URX#U5$)zReturn most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command. (typ, [data]) = .recent() 'data' is None if no new messages, else list of RECENT responses, most recent last. RECENTrN)_untagged_responsenooprgnametypdats rJrecent IMAP4.recenttsO**4$> r78O99;&&s66rIcFURUS/UR55$)zReturn data for response 'code' if received, or None. Old value for response 'code' is cleared. (code, [data]) = .response(code) N)rupper)rgcodes rJresponseIMAP4.responses!&&tdVTZZ\BBrIcSnU(dSnU(aUSUS4S:waSU-nOSnU(a [U5nOSn[R[U5nUR(aSU-S -nX`lUR XQX#5$) zAppend message to named mailbox. (typ, [data]) = .append(mailbox, flags, date_time, message) All args except `message' can be None. rINBOXrr()(%s)NsUTF8 ())r MapCRLFsubCRLFrorY_simple_command)rgmailboxflags date_timemessagerrYs rJappend IMAP4.appendsG ar#y0E ))4II++dG,   ')D0G ##D5DDrIcUR5n[U5RUlUR SU5upEUS:wa$UR USR SS55eSUlXE4$)a#Authenticate command - requires response processing. 'mechanism' specifies which authentication mechanism is to be used - it must appear in .capabilities in the form AUTH=. 'authobject' must be a callable object: data = authobject(response) It will be called to process server continuation responses; the response argument it is passed will be a bytes. It should return bytes data that will be base64 encoded and sent to the server. It should return None if the client abort response '*' should be sent instead. rrrr{replacer)r_AuthenticatorprocessrYrrKdecoderX)rg mechanism authobjectmechrrs rJ authenticateIMAP4.authenticatesk   &j199 ''= $;**SW^^GY?@ @ xrIcPSnURU5up#URX#U5$)zL(typ, [data]) = .capability() Fetch capabilities list from server.rrrrs rJ capabilityIMAP4.capabilitys.''-&&s66rIc$URS5$)zBCheckpoint mailbox on server. (typ, [data]) = .check() rrrxs rJcheck IMAP4.checks ##G,,rIcVURS5upSUlX4$!SUlf=f)zClose currently selected mailbox. Deleted messages are removed from writable mailbox. This is the recommended command before 'LOGOUT'. (typ, [data]) = .close() rrrrXrgrrs rJr IMAP4.closes2 ++G4HCDJx DJ (c&URSX5$)zrCopy 'message_set' messages onto end of 'new_mailbox'. (typ, [data]) = .copy(message_set, new_mailbox) rr)rg message_set new_mailboxs rJcopy IMAP4.copys ##FKEErIc&URSU5$)z@Create new mailbox. (typ, [data]) = .create(mailbox) rrrgrs rJcreate IMAP4.create ##Hg66rIc&URSU5$)z@Delete old mailbox. (typ, [data]) = .delete(mailbox) rrrs rJdelete IMAP4.deleterrIc&URSX5$)zpDelete the ACLs (remove any rights) set for who on mailbox. (typ, [data]) = .deleteacl(mailbox, who) rr)rgrwhos rJ deleteaclIMAP4.deleteacls ##K>>rIcSUR;a[RS5eURSU5up#US:Xa$SUR 5;aUR 5 X#4$)z\Send an RFC5161 enable string to the server. (typ, [data]) = .enable(capability) rzServer does not support ENABLErz UTF8=ACCEPT)rrrKrrr|)rgrrrs rJenable IMAP4.enables_ 4,, ,++>? ?((:>  $;=J,<,<,>> OO yrIcPSnURU5up#URX#U5$)zPermanently remove deleted items from selected mailbox. Generates 'EXPUNGE' response for each deleted message. (typ, [data]) = .expunge() 'data' is list of 'EXPUNGE'd message numbers in order received. rrrs rJexpunge IMAP4.expunges.''-&&s66rIcRSnURX1U5upEURXEU5$)zFetch (parts of) messages. (typ, [data, ...]) = .fetch(message_set, message_parts) 'message_parts' should be a string of selected parts enclosed in parentheses, eg: "(UID BODY[TEXT])". 'data' are tuples of message part envelope and data. r r)rgr message_partsrrrs rJfetch IMAP4.fetch"s0''=I&&s66rIcNURSU5up#URX#S5$)zHGet the ACLs for a mailbox. (typ, [data]) = .getacl(mailbox) r!ACLrrgrrrs rJgetacl IMAP4.getacl1s+ ''':&&s77rIcPURSXU5upEURXES5$)zY(typ, [data]) = .getannotation(mailbox, entry, attribute) Retrieve ANNOTATIONs.r" ANNOTATIONr)rgrentry attributerrs rJ getannotationIMAP4.getannotation:s-''S&&s>>rIcNURSU5up#URX#S5$)zGet the quota root's resource usage and limits. Part of the IMAP4 QUOTA extension defined in rfc2087. (typ, [data]) = .getquota(root) r#QUOTAr)rgrootrrs rJgetquotaIMAP4.getquotaBs+'' D9&&s99rIcURSU5up#URX#S5up$URX#S5up%X%U/4$)zGet the list of quota roots for the named mailbox. (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = .getquotaroot(mailbox) r$r7 QUOTAROOTr)rgrrrquota quotaroots rJ getquotarootIMAP4.getquotarootMsN ''@,,Sw? 00;G&&&rIcRSnURX1U5upEURXEU5$)zList mailbox names in directory matching pattern. (typ, [data]) = .list(directory='""', pattern='*') 'data' is list of LIST responses. r&rrg directorypatternrrrs rJlist IMAP4.listX0''A&&s66rIcURSXRU55up4US:waURUS5eSUlX44$)z|Identify client using plaintext password. (typ, [data]) = .login(user, password) NB: 'password' will be quoted. r'rrr)r_quoterKrX)rguserpasswordrrs rJlogin IMAP4.logindsI''{{87LM $;**SW% % xrIcVXsUlUlURSUR5$)zaForce use of CRAM-MD5 authentication. (typ, [data]) = .login_cram_md5(user, password) zCRAM-MD5)rJrKr_CRAM_MD5_AUTH)rgrJrKs rJlogin_cram_md5IMAP4.login_cram_md5rs+ $(  4=  T-@-@AArIcSSKn[UR[5(aURR S5O URnUR S-UR X1S5R5-$)z0Authobject to use with CRAM-MD5 authentication. rNr{ md5)hmac isinstancerKstrencoderJHMAC hexdigest)rg challengerUpwds rJrOIMAP4._CRAM_MD5_AUTH{sZ0:4==#0N0Nt}}##G,26-- yy335!A!K!K!MMMrIc\SUlURS5upUR5 X4$)zdShutdown connection to server. (typ, [data]) = .logout() Returns server 'BYE' response. r)rXrrdr s rJr IMAP4.logouts- ''1 xrIcRSnURX1U5upEURXEU5$)zList 'subscribed' mailbox names in directory matching pattern. (typ, [data, ...]) = .lsub(directory='""', pattern='*') 'data' are tuples of message part envelope and data. r(rrBs rJlsub IMAP4.lsubrGrIcNURSU5up#URX#S5$)zsShow my ACLs for a mailbox (i.e. the rights that I have on mailbox). (typ, [data]) = .myrights(mailbox) r%rr-s rJmyrightsIMAP4.myrightss+ &&z7;&&s<.namespace() r*rrs rJ namespaceIMAP4.namespaces. ''-&&s66rIc|URS:aURUR5 URS5$)z6Send NOOP command. (typ, [data]) = .noop() rr+)rW_dump_urr[rrxs rJr IMAP4.noops5 zzQ d556##F++rIcTSnURXQX#U5upgURXgS5$)zFetch truncated part of a message. (typ, [data, ...]) = .partial(message_num, message_part, start, length) 'data' is tuple of message part envelope and data. r,r r)rg message_num message_partstartlengthrrrs rJpartial IMAP4.partials3''.proxyauth(user) r-r)rgrJrs rJ proxyauthIMAP4.proxyauths##K66rIc&URSX5$)z[Rename old mailbox name to new. (typ, [data]) = .rename(oldmailbox, newmailbox) r.r)rg oldmailbox newmailboxs rJrename IMAP4.renames ##HjEErIcSnU(a>UR(a[RS5eUR"USU/UQ76upEOUR"U/UQ76upEUR XEU5$)zSearch mailbox for matching messages. (typ, [data]) = .search(charset, criterion, ...) 'data' is space separated list of matching message numbers. If UTF8 is enabled, charset MUST be None. r/z'Non-None charset not valid in UTF8 modeCHARSET)rorrKrr)rgcharsetcriteriarrrs rJsearch IMAP4.searchsl   kk"KLL++D)WPxPHC++D<8.select(mailbox='INBOX', readonly=False) 'data' is count of messages in mailbox ('EXISTS' response). Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so other responses should be obtained via .response('FLAGS') etc. rr0rrr READ-ONLYrz%s is not writableEXISTSN)r[r]rrXrWrjrSget)rgrrSrrrs rJselect IMAP4.selects#%# DD''6 $;DJ8O $11 1 ::?MM$"9"9:-- 4w >? ?++//4&AAArIc(URSXU5$)zJSet a mailbox acl. (typ, [data]) = .setacl(mailbox, who, what) r1r)rgrrwhats rJsetacl IMAP4.setacl s ##HgDAArIcPUR"S/UQ76up#URX#S5$)zW(typ, [data]) = .setannotation(mailbox[, entry, attribute]+) Set ANNOTATIONs.r2r1r)rgrrrs rJ setannotationIMAP4.setannotations.''?$?&&s>>rIcNURSX5up4URX4S5$)zYSet the quota root's resource limits. (typ, [data]) = .setquota(root, limits) r3r7r)rgr8limitsrrs rJsetquotaIMAP4.setquotas+ '' DA&&s99rIc|SnUSUS4S:waSU-nUR"XAU/UQ76upVURXVU5$)zqIMAP4rev1 extension SORT command. (typ, [data]) = .sort(sort_criteria, charset, search_criteria, ...) r4rrrrr)rg sort_criteriar}search_criteriarrrs rJsort IMAP4.sort$sX  ! ]2. /9 <"]2M''WWW&&s66rIc,Sn[(dURS5eUR(aURS5eX R;aURS5eUc[ R "5nURU5up4US:XaaURURURS9Ul URRS5Ul SUlUR5 OURS 5eURX4U5$) Nr5zSSL support missingzTLS session already establishedzTLS not supported by serverrserver_hostnamerTzCouldn't establish TLS session)HAVE_SSLrKr_rOrssl_create_stdlib_contextr wrap_socketrrhrrrr)rg ssl_contextrrrs rJstarttlsIMAP4.starttls2sx**23 3  **>? ? (( (**:; ;  446K''- $;#// @D 0KDI **40DI$(D !  " " $**=> >&&s66rIcRSnURX1U5upEURXEU5$)z`Request named status conditions for mailbox. (typ, [data]) = .status(mailbox, names) r6r)rgrnamesrrrs rJstatus IMAP4.statusIs2 ''u=&&s66rIcvUSUS4S:waSU-nURSXU5upEURXES5$)zqAlters flag dispositions for messages in mailbox. (typ, [data]) = .store(message_set, command, flags) rrrrr7r r)rgrcommandrrrs rJstore IMAP4.storeUsK !HU2Y 9 ,UNE''uM&&s99rIc&URSU5$)zISubscribe to new mailbox. (typ, [data]) = .subscribe(mailbox) r8rrs rJ subscribeIMAP4.subscribe`s ##K99rIcVSnUR"XAU/UQ76upVURXVU5$)z{IMAPrev1 extension THREAD command. (type, [data]) = .thread(threading_algorithm, charset, search_criteria, ...) r9r)rgthreading_algorithmr}rrrrs rJthread IMAP4.threadhs5 ''7]_]&&s66rIc nUR5nU[;aURSU-5eUR[U;a=URSU<SUR<SSR [U5<35eSnUR "X1/UQ76upEUS;aUnOSnUR XEU5$) zExecute "command arg ..." with messages identified by UID, rather than message number. (typ, [data]) = .uid(command, arg1, arg2, ...) Returns response appropriate to 'command'. zUnknown IMAP4 UID command: %scommand  illegal in state , only allowed in states , r:)r/r4r9r )rrrKrXjoinrr)rgrrrrrs rJuid IMAP4.uidrs--/("**.unsubscribe(mailbox) r;rrs rJ unsubscribeIMAP4.unsubscribes ##M7;;rIcVURS5upSUlX4$!SUlf=f)aFree server's resources associated with the selected mailbox and returns the server to the authenticated state. This command performs the same actions as CLOSE, except that no messages are permanently removed from the currently selected mailbox. (typ, [data]) = .unselect() r<rr )rgrrs rJunselectIMAP4.unselects3 ,,Z8ICDJy DJrcUR5nU[;aUR4[U'UR"U/UQ76$)zAllow simple extension commands notified by server in CAPABILITY response. Assumes command is legal in current state. (typ, [data]) = .xatom(name, arg, ...) Returns response appropriate to extension command `name'. )rrrXrrgrrs rJxatom IMAP4.xatoms>zz|x"jj]HTN##D0400rIc UcSnURnURS:a7URSU<S[UR US55<SU<S35 X;aX1R U5 gU/X1'g)NrIuntagged_responses[z] rTz += ["z"])r[rWrrrr)rgrrurs rJ_append_untaggedIMAP4._append_untaggedsh ;C  $ $ zzQ c"&&R.1389 9 GNN3 eBGrIcURRS5nU(a.URUSRURS55eg)NBYErr)r[rrOrrp)rgbyes rJ _check_byeIMAP4._check_byesB%%))%0 **SW^^DNNIFG G rIc UR[U;aDSUlURSU<SUR<SSR [U5<35eSH!nX0R ;dMUR U M# SUR ;a"UR (dURS5eUR5n[XR5nUS-U-nUH:nUcM[U[5(a[X`R5nUS-U-nM< URnUbRSUl[U5[UR5LaUnO'SnU[S [U5-UR5-nUR S :aUR#S U-5 OUR%S U-5 UR'U[(-5 UcU$UR/5(a-UR0U(aU$UR/5(aM-W(aU"UR25nUR S :aUR#S [U5-5 UR'U5 UR'[(5 U(dU$M![*an UR-S U -5eSn A ff=f![*an UR-S U -5eSn A ff=f)NrrrrrNOBADrz#mailbox status changed to READ-ONLY z {%s}z> %rzsocket error: %szwrite literal size %s)rXrrYrKrr[r]rS_new_tagbytesrprVrWtype_commandrrWr_logrrrerOrrZr\) rgrrrtagrargrY literatorvals rJrIMAP4._commands ::Xd^ +DL**"DJJ"ii79: : 'C---++C0' $11 1  -- EF FmmoT>>*TzD C{H#s##C0$;$D  ,,  DLG}T]] 33#  eGc'l$:DNNKK zzQ 6D=) &4-( 7 IIdTk " ?J$$&&'',J$$&& #D$>$>?::?JJ6WEF ; '" $ 3  7**/#56 6 72 ;jj!3c!9:: ;s0>J&&J> J;"J66J;> K!KK!cUS:HnU(dUR5 URX#S9upEU(dUR5 US:XaURU<SU<SU<35eXE4$!URanURSU<SU<35eSnAfURanURSU<SU<35eSnAff=f)Nr) expect_byez command:  => rz command error: rS)r_get_tagged_responserOrK)rgrrrrrrs rJ_command_completeIMAP4._command_completes(" OO  @11#1IIC  OO  %<**$TJK Kyzz @**D#>? ?zz @**D#>? ? @s#A++C;BC'CCcUR5upUS/:XaURS5e[USUR5nUR 5n[ UR 55Ulg)Nz"no CAPABILITY response from serverr)rrKrWrprtuplesplitrr s rJrIMAP4._get_capabilities,s[??$ 4&=**AB B#b'4>>*iik!#))+.rIcUR5nURURU5(aURR S5nX R ;aUR SU-5eURR S5n[X0R5nURR S5nX4/4UR U'GOSnUR[U5(d<URURU5(aURR S5nURcPUR[U5(a!URR S5Ul gUR SU-5eURR S5n[X0R5nURR S5nUcSnU(aUS-U-nURURU5(a[URR S 55nURS :aUR!S U-5 UR#U5nUR%X4U45 UR5nURURU5(aMUR%X45 US ;auUR[&U5(aZURR S5n[X0R5nUR%X0RR S55 URS :aUS;aUR!U<SU<35 U$)Nrzunexpected tagged response: %rrrdata2zunexpected response: %rrIrrrzread literal size %srr)rrrz response: ) _get_line_matchrmogrouprZrOrWrpUntagged_responserw Continuationr\ruintrWrrr Response_code)rgresprrrdat2rrs rJrIMAP4._get_response5s~~ ;;tzz4 ( (''--&C...jj!AD!HII''--'Cc>>*C''--'C),e D  %D;;0$77;;t33T::77==1Dww;;|T2215v1FD.jj!:T!ABB''--'Cc>>*C''--'C{#C3:,S++dllC00477==01zzQ #9D#@Ayy%%c;7nn&!++dllC00$  ! !# + % %$++mS*I*I''--'Cc>>*C  ! !#ww}}V'< = zzQ3*>#> S9: rIcVURUnUbURU U$U(a$SnURRUS5nUbXE4$UR5 UR 5 Mo!UR a'nUR S:aUR5 eSnAff=f)Nrr)rZr[poprrrOrW print_log)rgrrresultrrrs rJrIMAP4._get_tagged_responses))#.F!((- --11#t<?:% OO  ""$/0:: zzQ(  sA11B("B##B(c*UR5nU(dURS5eURS5(dURSU-5eUSSnURS:aUR SU-5 U$UR SU-5 U$)Nzsocket error: EOFr z#socket error: unterminated line: %rrz< %r)rrOendswithrWrrrs rJrIMAP4._get_lines}}**01 1}}W%%**BTIJ JCRy zzQ 6D=)  &4-( rIcURU5UlURbKURS:a;URSUR<SURR 5<35 URSL$)Nrz matched r)matchrrWrrDgroups)rgcress rJr IMAP4._matchsY ))A, ww"tzzQ 3;;@PQRwwd""rIcUR[[UR5UR5-nURS-UlSUR U'U$)Nr)rrrWr^rprZ)rgrs rJrIMAP4._new_tagsHkkE#dkk"2DNNCCkkAo $(S! rIcZURSS5nURSS5nSU-S-$)N\z\\"z\")r)rgrs rJrI IMAP4._quotes0kk$'kk#u%Sy3rIcFURXR"U/UQ765$r)rrrs rJrIMAP4._simple_commands!%%dMM$,F,FGGrIcUS:XaX4$X0R;aUS/4$URRU5nURS:aURSU<SU<35 X4$)Nrrrz] => )r[rrWr)rgrrrrs rJrIMAP4._untagged_responsese $;8O...; &&**40 zzQ T4HIyrIcUc[R"5n[R"S[R"U55n[RR SX2S-S-U4-5 [RR 5 g)Nz%M:%Sz %s.%02d %s d)timestrftime localtimerstderrwriteflush)rgrsecstms rJr IMAP4._mesgs`|yy{wt(<=B JJ  -3h^Q0GG H JJ   rIcU(dgSUR55nURSSRU5-5 g)Nc36# UHupUSU<3v M g7f): NrB).0keyvalues rJ !IMAP4._dump_ur..s%B&@ uBui(&@szuntagged responses dump:z )itemsrr)rguntagged_resp_dictr s rJrjIMAP4._dump_urs=%B&8&>&>&@BE JJ1HMM%4HH IrIcU[R"54URUR'U=RS- slURUR:aSUlgg)Nrr)rrrrrs rJr IMAP4._logsS04diik/BDMM$++ ,    "   D$5$55$%!6rIc URS[UR5-5 URURp!U(aBUR"URU6 US- nXR:aSnUS-nU(aMAgg! N*=f)Nzlast %d IMAP4 interactions:rr)rrrrr)rgins rJrIMAP4.print_logs JJ4s4==7II J$$d&7&7qJJ a 01Q)))AQ!s B B )rurrwrrrrpr_rr\rWrrhr]rYrrKrirrXrZr^rrr[rJror)z""*)rFr)F)WrDrErFrG__doc__rcrKrOrS IMAP4_PORTrkr`r|rbrrrrrarrrrdrrrrrrr rrrrrr"r%r)r.r4r9r?rErLrPrOrrardrgrrqrtryrrrrrrrrrrrrrrrrrrrrrrrrrrIrrrrjrrrHrBrIrJrrs-^!  5Z2F<'7TC  1T -  7"CE4:7- F77?  7 78?:' 7 BN  7=7, : 7F7$B@B?: 77. 7::772<  1, H JZ$/M`B& #H   J & rIrcF\rSrSrSrS\4SSS.SjjrSrS\S4SjrS r g) IMAP4_SSLi a?IMAP4 client class over SSL connection Instantiate with: IMAP4_SSL([host[, port[, ssl_context[, timeout=None]]]]) host - host's name (default: localhost); port - port number (default: standard IMAP4 SSL port); ssl_context - a SSLContext object that contains your certificate chain and private key (default: None) timeout - socket timeout (default: None) If timeout is not given or is None, the global default socket timeout is used for more documentation see the docstring of the parent class IMAP4. rTN)rrjclUc[R"5nX0l[R XX$5 gr)rrrrrk)rgrhrirrjs rJrkIMAP4_SSL.__init__s*"!88: *  NN4t 5rIct[RX5nURRUURS9$)Nr)rrrrrh)rgrjrs rJrIMAP4_SSL._create_socket%s;''6D##//@D 0K KrIc0[RXX#5 g)zSetup connection to remote server on "host:port". (default: localhost:standard IMAP4 SSL port). This connection will be used by the routines: read, readline, send, shutdown. N)rrarfs rJraIMAP4_SSL.open*s JJt4 1rI)r) rDrErFrGr*IMAP4_SSL_PORTrkrrarHrBrIrJr-r- s1 !# 6$($ 6 K ^T 2rIr-c@\rSrSrSrSrS SjrSrSrSr S r S r g) ri5zIMAP4 client class over a stream Instantiate with: IMAP4_stream(command) "command" - a string that can be passed to subprocess.Popen() for more documentation see the docstring of the parent class IMAP4. c:Xl[RU5 gr)rrrk)rgrs rJrkIMAP4_stream.__init__As  trINc 8SUlSUlSUlSUl[R "UR [[R[RSSS9Ul URRUl URRUl g)zmSetup a stream connection. This connection will be used by the routines: read, readline, send, shutdown. NT)bufsizestdinstdoutshell close_fds)rhrirr subprocessPopenrrPIPErr: writefiler;readfilerfs rJraIMAP4_stream.openFsq     !'' '//*//$( ++ ++ rIc8URRU5$r)rBr)rgrs rJrIMAP4_stream.readVs}}!!$''rIc6URR5$)r)rBrrxs rJrIMAP4_stream.readline[s}}%%''rIcnURRU5 URR5 g)rN)rArrrs rJrIMAP4_stream.send`s$ T" rIcURR5 URR5 URR 5 g)rN)rBrrArwaitrxs rJrdIMAP4_stream.shutdownfs2   rI)rrrhrirrBrrA)NNN) rDrErFrGr*rkrarrrrdrHrBrIrJrr5s% , ( (  rIrc0\rSrSrSrSrSrSrSrSr g) rinzSPrivate class to provide en/decoding for base64-based authentication conversation. cXlgrr)rgmechinsts rJrk_Authenticator.__init__ts rIclURURU55nUcgURU5$)N*)rrrX)rgrrets rJr_Authenticator.processws0ii D)* ;{{3rIcSn[U[5(aURS5nU(aK[U5S:a USSnUSSnOUnSn[R "U5nU(aX$SS-nU(aMKU$)NrIr{0r)rVrWrXrbinascii b2a_base64)rginpouptes rJrX_Authenticator.encode}s c3  **W%C3x"}H"#h##A&AcrFlc rIc>U(dg[R"U5$)NrI)rX a2b_base64)rgrZs rJr_Authenticator.decodes""3''rIrON) rDrErFrGr*rkrrXrrHrBrIrJrrns 0(rIrz0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov DecrSrc [RU5nU(dg[URS5nURS5n[ URS55n[ URS55n[ URS55n[ URS55n[ URS55n[ URS 55n [ URS 55n U S -U -S -n US :XaU *n XRXFXxS S S 4 n [ R "U 5U - n [R"U 5$)zParse an IMAP4 INTERNALDATE string. Return corresponding local time. The return value is a time.struct_time tuple or None if the string has wrong format. Nmonzonendayyearhourrseczonehzonem<-r) InternalDaterMon2numrrcalendartimegmrr)rrrcrdrerfrgrrhrirjzonettutcs rJr r s   D !B  "((5/ "C HHW E bhhuo C rxx D rxx D bhhuo C bhhuo C ! "E ! "E "Hu b D }u S"b" 5B //"  $C >># rIcSnSn[[U55nU(a![US5upX#US-U-nU(aM!U$)z-Convert integer to A-P string representation.rIsABCDEFGHIJKLMNOPr)rabsdivmod)numrAPmods rJr r sK C'r c#h-C #r?SUmc! # JrIc[RU5nU(dg[URS5R 55$)z-Convert IMAP4 flags response to python tuple.rBr)Flagsrrrr)rrs rJr r s5 T B  '"((* ++rIcx[U[[45(a4[R"U[ R 5R5nO[U[5(a.URn[!US9n[USSS[ U506nO`[U[5(aUR"c [%S5eUnO0[U[&5(aUSUS4S :XaU$[%S 5eS R)[*UR,5nUR/U5$![a [R(a_USnUS:Xa-[R"[R"U55Sn[R [R4U*nGN2[R *nGNFf=f) aConvert date_time to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'. The date_time argument can be a number (int or float) representing seconds since epoch (as returned by time.time()), a 9-tuple representing local time, an instance of time.struct_time (as returned by time.localtime()), an aware datetime instance or a double-quoted string. In the last case, it is assumed to already be in the correct format. r)secondsNtzinfozdate_time must be awarer)rrzdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z")rVrfloatr fromtimestamprrs astimezoner tm_gmtoffrrdaylightrmktimealtzonerrrrWformatMonthsmonthr)rdtgmtoffdstrfmts rJr r sh)c5\**  # #I$,LL22<*, Iu % % (((F&) y!} =Xe_ = Ix ( (    #67 7  Is # #1im(D (Q899 " ) )&*: ;C ;;s ' (}}l"9..Y)?@CC==$,,7<<-- (s& D&&A;F9$F98F9__main__zd:s:)rBrBz-dz-s)rTzIMAP password for z on localhostrzJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s )rJlfrL)r) /tmp/xxx 1)ry)rz/tmp/yyy)r /tmp/yyz 2rr)rE)z/tmpzyy*)rr)r)NSUBJECTtest)r))1z(FLAGS INTERNALDATE RFC822))r)rFLAGSz (\Deleted))rgrB)r%rB)rrB)rrB)rrB)r) UIDVALIDITY)r)r/ALL)r)r)rrBc[RU<SU<35 [[U5"U6up#[RU<SU<SU<35 US:XaUSeU$)NrSrrr)Mrr)cmdrrrs rJrunr9sL 3%&1c?D) c3/0 $;c!f  rIrzPROTOCOL_VERSION = %szCAPABILITIES = rE)z/tmp/zyy%z .*"([^"]+)"$rrrz%sz:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)z All tests OK.z Tests failed.z8 If you would like to see debugging output, try: %s -d5 )Wr*rrXrrrqrr>rrrorrriorrr ImportError__all__rrVr+r4rrrrrrrr|rmrtrurrrrwrsrvrr-rrrrr enumeraterXrnr r r r rDgetoptgetpassargvoptlistrrKrstream_commandoptrrhgetuserUSERPASSWD test_mesg test_seq1 test_seq2rrrXrrrrmlrrrpathrrprint)r'rs00rJrsU , KKKKK22"H 8    ( , ,,   ,  A ,  ,  ,   ,  ,,  ,,  ,,   ,  ,,   ,   ,  ,, ,!, " ,#, $ ,%, & ,', ( ,), *  +, , A-, . ,/, 0  1, 2 ,3, 4 A5, 6  7, 8  9, : ,;, <  =, > ,?, @ ,A, B ,C, D ,E, F  G, H%,%,%%,%W, `zz01  45zz **+RXX 6 **^ $ DE JJGH**;RXXG "J~~B$ #2E#2J NN;555r*(*(X < A A# F&/qr &; <&;da188:ac>&; <F ,%R z  chhqrlF; NC $;HE D[ N4 1   7D ?? D __tTEX[EXY ZF\gkrv_wwI tVn* dD)45)3,I$! dD),-I) ^,Ad A 77f !!" I '!*<*<<= q~~78!HC TN"f./B/2.B"((1+4B$ 4' " 0 "HCc4.CDz77b'--/C BPR S"  {C/Hv+ =` << j     hhqk  s<P P#P%!D-QPP%Q5QQ*Q2