eWSrSS/rSSKrSSKrSSKrSSKJrJr SSKJ r SSKJ r SSK J r SS KJ r SS KJr \R"rS r\R&"S 5rS rSSjrSrSrSr"SS5r"SS\5r"SS\5rg)z8Basic message object for the email package object model.Message EmailMessageN)BytesIOStringIO)utils)errors)compat32charset)decode_bz; z[ \(\)<>@,;:\\"/\[\]\?=]c[U5RS5upnU(dUR5S4$UR5UR54$)N;)str partitionstrip)paramasepbs 3/opt/imh/python3.13/lib/python3.13/email/message.py _splitparamrsF E $$S)IAA wwy$ 779aggi cUb[U5S:a[U[5(a/US- n[R"USUSUS5nU<SU<3$UR S5 U(d[RU5(aU<S [R"U5<S 3$U<SU<3$U$![ a) US- n[R"USS5nU<SU<3s$f=f) afConvenience function to format and return a key=value pair. This will quote the value if needed or if quote is true. If value is a three tuple (charset, language, value), it will be encoded according to RFC2231 rules. If it contains non-ascii characters it will likewise be encoded according to RFC2231 rules, using the utf-8 charset and a null language. r*=asciizutf-8z="") len isinstancetuplerencode_rfc2231encodeUnicodeEncodeError tspecialssearchquote)rvaluer)s r _formatparamr+'s SZ!^ eU # # SLE((q58U1XFE#U+ + 0 W% I$$U++ %u{{5'9: :#U+ + & 0 ,,UGR@"'// 0sB330C&%C&cS[U5-n/nUSSS:XGa-USSnURS5nUS:a{URSSU5URSSU5- S-(aLURSUS-5nUS:a1URSSU5URSSU5- S-(aMLUS:a [U5nUSUnSU;aKUR S5nUSUR 5R 5S-X4S-SR 5-nURUR 55 XSnUSSS:XaGM-U$)Nrrrr z\"rr)rfindcountr!indexrlowerappend)splistendfis r _parseparamr7Is> c!f A E BQ%3, abEffSkAg17733/!''%C2HHAM&&cAg&CAg17733/!''%C2HHAMM 7a&C dsG !8 A"1 ##%+a!gmmo=A QWWY dG BQ%3, Lrc[U[5(a"USUS[R"US54$[R"U5$)Nrrr)r"r#runquote)r*s r _unquotevaluer:]sB %Qxq5==q#:::}}U##rcr/n[UR55nUHInURS5(dMURS5R S5upEn[ USS9 O [ S5eUHTnU(d [ S5eURS5S:Xa O,[R"U5nURU5 MV SRU5$![ a Mf=f![Ra0 US S - S -S -S -S-n[R"USU5nNzf=f)zDecode uuencoded data.sbegin  )basez`begin` line not foundzTruncated inputs sendr ?Nr) iter splitlines startswith removeprefixrint ValueErrorrbinasciia2b_uuErrorr1join) encoded decoded_linesencoded_lines_iterlinemode_path decoded_linenbytess r _decode_uurWhs3Mg0023" ??9 % % --i8BB4HMDT Dq!#122"./ / ZZ % /  :#??40L \*# 88M ""'  ~~ :Q b(A-1a7F#??4=9L :s% C!%C2! C/.C/2AD65D6c|\rSrSrSr\4SjrSrS4SjrSr S5S jr S r S r S r S rS6SjrS7SjrSrSrSrSrSrSrSrSrSrSrSrS7SjrSrSrS7SjrSr S r!S!r"S"r#S#r$S$r%S%r&S&r'S8S'jr(S8S(jr)S9S)jr*S:S*jr+S;S+jr,S7S,jr-S7S-jr.S.r/S7S/jr0S7S0jr1S1r2SS2K3J4r4 S3r5g)>'3DE $ $&&x0 0 H_&chhx/B/B/D&EFNE! ))$7"L > > !(++ gs # #O?'F"*//'9"EN F)N & @ #>>*>?  @$  sTH:-!H(I 3 I,H73H:6H77H:: II I)(I), I;:I;c:[US5(aFUcXlg[U[5(d [U5nUR UR S5n[US5(aUR SS5UlOXlUbURU5 gg)zSet the payload to the given value. Optional charset sets the message's default character set. See set_charset() for details. r%Nrrr)rr_r"Charsetr%output_charsetr set_charset)rerr s r set_payloadMessage.set_payloadOs 7H % % ' gw//!'*nnW%;%;=NOG 7H % %#NN74EFDM#M     W % rcUcURS5 SUlg[U[5(d [U5nXlSU;aUR SS5 SU;a UR SSUR 5S9 O UR SUR 55 XR 5:wa URUR5UlSU;aUR5nU"U5 gg![a} URnU(a?URS S 5nO+![a URUR5nOf=fURU5UlUR SU5 gf=f) aSet the charset of the payload to a given character set. charset can be a Charset instance, a string naming a character set, or None. If it is a string it will be converted to a Charset instance. If charset is None, the charset parameter will be removed from the Content-Type field. Anything else will generate a TypeError. The message will be assumed to be of type text/* encoded with charset.input_charset. It will be converted to charset.output_charset and encoded properly, if needed, when generating the plain text representation of the message. MIME headers (MIME-Version, Content-Type, Content-Transfer-Encoding) will be added as needed. Nr MIME-Version1.0 Content-Typer[r zContent-Transfer-Encodingrr) del_paramr`r"r add_headerget_output_charset set_param body_encoder_get_body_encodingrr% UnicodeErrorr)rer rrs rrMessage.set_charsetcs_ ? NN9 % DM '7++g&G  % OONE 2  % OONL$+$>$>$@  B NN9g&@&@&B C 002 2#// >DM &d 2++-C BD  3 B--I")..:K"L'I")..1G1G"HI ' 3 3G <  ;SA Bs6+C55E<D&%E<&%E E< E+E<;E<cUR$)zKReturn the Charset instance associated with the message's payload. )r`rjs r get_charsetMessage.get_charsets}}rc,[UR5$)z9Return the total number of headers, including duplicates.)r!r]rjs r__len__Message.__len__s4==!!rc$URU5$)aGet a header value. Return None if the header is missing instead of raising an exception. Note that if the header appeared multiple times, exactly which occurrence gets returned is undefined. Use get_all() to get all the values matching a header field name. )r)renames r __getitem__Message.__getitem__sxx~rcrURRU5nU(aaUR5nSnURH?upgUR5U:XdMUS- nXS:dM'[ SR X155e URR URRX55 g)zSet the value of a header. Note: this does not overwrite an existing header with the same field name. Use __delitem__() first to delete any existing headers. rrz/There may be at most {} {} headers in a messageN)r\header_max_countr0r]rIformatr1header_store_parse)rerval max_countlnamefoundkvs r __setitem__Message.__setitem__s KK006 JJLEE 779%QJE)(*88>y8OQQ & T[[;;DFGrcUR5n/nURH-up4UR5U:wdMURX445 M/ X lg)zgDelete all occurrences of a header, if present. Does not raise an exception if the header is missing. N)r0r]r1)rer newheadersrrs r __delitem__Message.__delitem__sI zz| MMDAwwyD !!1&)"# rcxUR5nURHup4X#R5:XdM g g)NTF)r0r])rer name_lowerrrs r __contains__Message.__contains__s1ZZ\ MMDAWWY&"rc#># URH upUv M g7frr])refieldr*s r__iter__Message.__iter__s MMLEK*scPURVVs/sHupUPM snn$s snnf)aReturn a list of all the message's header field names. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. rrerrs rkeys Message.keyss"#mm,mdam,,,s"cURVVs/sH upURRX5PM" snn$s snnf)aReturn a list of all the message's header values. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. r]r\header_fetch_parsers rvaluesMessage.valuess>!MM+)DA ..q4)+ ++s';c URVVs/sH!upXRRX54PM# snn$s snnf)zGet all the message's header fields and values. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. rrs ritems Message.itemssA!MM+)DAKK22189)+ ++s(<cUR5nURH6up4UR5U:XdMURRX45s $ U$)zfGet a header value. Like __getitem__() but return failobj instead of None when the field is missing. )r0r]r\r)rerfailobjrrs rr Message.getsI zz|MMDAwwyD {{55a;;"rc<URRX45 g)zwStore name and value in the model without modification. This is an "internal" API, intended only for use by a parser. N)r]r1)rerr*s rset_rawMessage.set_raws d]+rcH[URR55$)z~Return the (name, value) header pairs without modification. This is an "internal" API, intended only for use by a generator. )rDr]copyrjs r raw_itemsMessage.raw_items s DMM&&())rc/nUR5nURHEupEUR5U:XdMURURR XE55 MG U(dU$U$)a)Return a list of all the values for the named field. These will be sorted in the order they appeared in the original message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. If no such fields exist, failobj is returned (defaults to None). )r0r]r1r\r)rerrrrrs rget_allMessage.get_alls\zz|MMDAwwyD  dkk<DAwwyEKKM)(++H ? rc[U[5(d U(aXVU4nX0;aUR5S:XaSnOURU5nUR XS9(d6U(d [ XU5nO[ RU[ XU5/5nOySnURUUS9HcupSn U R5UR5:Xa [ XU5n O [ XU5n U(dU nMM[ RX/5nMe XRU5:wa U(aURX85 gX XU'gg)aSet a parameter in the Content-Type header. If the parameter already exists in the header, its value will be replaced with the new value. If header is Content-Type and has not yet been defined for this message, it will be set to "text/plain" and the new parameter and value will be appended as per RFC 2045. An alternate header can be specified in the header argument, and all parameters will be quoted as necessary unless requote is False. If charset is specified, the parameter will be encoded according to RFC 2231. Optional language specifies the RFC 2231 language, defaulting to the empty string. Both charset and language should be strings. rr[)r rr r9N) r"r#r0rr)r+rrMr&r) rerr*r requoter languagerr  old_param old_value append_params rrMessage.set_params%$%''G.E  &,,.N"B EHHV$E~~e~3$U7;!Lw?@BE(,v@G)8)I$ ! ??$ 5#/g#FL#/ g#NL(E%NNE+@AE)I HHV$ $##F2L$V %rc .X ;agSnURX#S9H_upVUR5UR5:wdM)U(d[XVU5nM>[R U[XVU5/5nMa X@R U5:waX X@U'gg)aRemove the given parameter completely from the Content-Type header. The header will be re-written in place without the parameter or its value. All values will be quoted as necessary unless requote is False. Optional header specifies an alternative to the Content-Type header. Nrr,)r&r0r+rrMr)rerr r- new_ctyper"rs rrMessage.del_params    OO6OCDAwwyEKKM) ,Q7 ;I ) 0^ +^$#(D  L @ LV 12JDA NN1 1rc[5nURSUS5nX2LaURSUS5nX2LaU$[R"U5R 5$)aReturn the filename associated with the payload if present. The filename is extracted from the Content-Disposition header's `filename' parameter, and it is unquoted. If that header is missing the `filename' parameter, this method falls back to looking for the `name' parameter. filenamecontent-dispositionrr)rr)rcollapse_rfc2231_valuer)rerr r:s r get_filenameMessage.get_filenameJs[(>>*g7LM  ~~fg~FH  N++H5;;==rc[5nURSU5nX2LaU$[R"U5R 5$)zReturn the boundary associated with the payload if present. The boundary is extracted from the Content-Type header's `boundary' parameter, and it is unquoted. boundary)rr)rr<rstrip)rerr r@s r get_boundaryMessage.get_boundaryZs@ (>>*g6  N++H5<<>>rc[5nURUS5nX2La[R"S5e/nSnUHEupgUR 5S:XaUR SSU-45 SnM3UR Xg45 MG U(dUR SSU-45 /nUR HupU R 5S:Xa/n UH6upU S:XaU R U 5 MU R U <SU <35 M8 [RU 5n UR URRX55 MUR X45 M Xlg ) aSet the boundary parameter in Content-Type to 'boundary'. This is subtly different than deleting the Content-Type header and adding a new one with a new boundary parameter via add_header(). The main difference is that using the set_boundary() method preserves the order of the Content-Type header in the original message. HeaderParseError is raised if the message has no Content-Type header. rzNo Content-Type header foundFr@z"%s"TrrN) rr#rHeaderParseErrorr0r1r]rrMr\r)rer@r r! newparamsfoundppkpvrhrrrrs r set_boundaryMessage.set_boundarygsD(**7NC  ))*HI I FBxxzZ'  *fx.?!@A  "*     j&8*;< = MMDAwwyN*%DABw Q 1%56 &  nnU+!!$++"@"@"HI!!1&)"# rcj[5nURSU5nX2LaU$[U[5(a.US=(d SnUSR S5n[ XT5nUR S5 UR5$![ [4a USnN9f=f![a Us$f=f)zReturn the charset parameter of the Content-Type header. The returned string is always coerced to lower case. If there is no Content-Type header, or if that header has no charset parameter, failobj is returned. r rzus-asciirr) rr)r"r#r%rrrr0)rerr r pcharsetrzs rrMessage.get_content_charsets(..G4  N gu % %qz/ZH %#1:,,-ABh1  NN: &}} . %!!* %  N s$B'B#B B # B21B2cjUR5Vs/sHo"RU5PM sn$s snf)a}Return a list containing the charset(s) used in this message. The returned list of items describes the Content-Type headers' charset parameter for this message and all the subparts in its payload. Each item will either be a string (the value of the charset parameter in the Content-Type header of that part) or the value of the 'failobj' parameter (defaults to None), if the part does not have a main MIME type of "text", or the charset is not defined. The list will contain one string for each part of the message, plus one for the container message (i.e. self), so that a non-multipart message will still return a list of length 1. )walkr)rerparts r get_charsetsMessage.get_charsetss, ?CiikJkd((1kJJJs0chURS5nUcg[U5SR5nU$)zReturn the message's content-disposition if it exists, or None. The return values can be either 'inline', 'attachment' or None according to the rfc2183. r;Nr)rrr0)rer*c_ds rget_content_dispositionMessage.get_content_dispositions8 ./ =% #))+ r)rQ) r`rdr]r_r^rcrbr\ra)FrN)FN)NFr)NrT)rTNrF)rT)rT)6__name__ __module__ __qualname____firstlineno____doc__r rfrkrir{rzrrrrrrrrrrrrrrrrrrrrrrrr rrr rr#r&r)rrr7r=rBrKrrSrWemail.iteratorsrQ__static_attributes__rrrrs ' * 0 /" : Zx&(-B^" H$ #- + + ",*$,< "&0##"#*,5C DFJ5:1%f%,2@> ?,#\<K$ %$rc^\rSrSrSU4SjjrSU4SjjrSrSrSrSSjr 1S kr S r S r SS .S jr SS .SjrSrSSjrSSjrSSjrSS.SjrSrSrSrSrSrSrU=r$)MIMEPartiNc:>UcSSKJn Un[TU] U5 g)Nr)default) email.policyrdsuperrf)rer\rd __class__s rrfMIMEPart.__init__s > ,F  rcd>Uc UROUnUc URn[TU] XU5$)aReturn the entire formatted message as a string. Optional 'unixfrom', when true, means include the Unix From_ envelope header. maxheaderlen is retained for backward compatibility with the base Message class, but defaults to None, meaning that the policy value for max_line_length controls the header maximum length. 'policy' is passed to the Generator instance used to serialize the message; if it is not specified the policy associated with the message instance is used. )r\max_line_lengthrfri)rerrrpr\rgs rriMIMEPart.as_strings7!'F  !11Lw @@rcNURURRSS9S9$)NT)utf8r\)rir\clonerjs rrkMIMEPart.__str__s%~~T[[%6%6D%6%A~BBrcLURS5nUcS$URS:H$)Nr;F attachment)rcontent_disposition)rerVs r is_attachmentMIMEPart.is_attachments+hh,- uP)@)@L)PPrc## UR5(agUR5RS5up4US:XaXB;aURU5U4v gUS:wdUR 5(dgUS:wa1UR 5HnUR XR5ShvN M gSU;aURS5U4v SnURS5nU(a$UR 5HnUSU:XdMUn O UcUR5nU(aUSOSnUbUR Xb5ShvN ggNN7f)Nrtext multipartrelatedstart content-idr) rtr rr/r iter_parts _find_bodyr)r) rerRpreferencelistmaintypesubtypesubpart candidaterzsubpartss rr}MIMEPart._find_bodysG       11399#> v (%++G4d;;  { "$*;*;*=*=  i ??,??7CCC-   &!'' 2D9 9 w' ??,<(E1 'I-  '')H'/ TI  yA A A !D Bs+B"E $E%AE >E ?EE E c|[U5nSnURX5HupEXB:dM UnUnUS:XdM U$ U$)aReturn best candidate mime part for display as 'body' of message. Do a depth first search, starting with self, looking for the first part matching each of the items in preferencelist, and return the part corresponding to the first item that has a match, or None if no items have a match. If 'related' is not included in preferencelist, consider the root part of any multipart/related encountered as a candidate match. Ignore parts with 'Content-Disposition: attachment'. Nr)r!r})rer~ best_priobodypriorRs rget_bodyMIMEPart.get_bodysO' //$?JD 19 @  r>rwhtmlrwplainrxryrx alternativec## UR5RS5upUS:wdUS:XagUR5nUR5nUS:XaUS:Xa}UR S5nU(aISn/nUH-nUR S5U:XaS nMURU5 M/ U(a UShvN gURS 5 UShvN g/n UHfnUR5RS5upX4UR;a-UR5(dX);aU RU5 MbUv Mh g![a gf=fNN7f) aReturn an iterator over the non-main parts of a multipart. Skip the first of each occurrence of text/plain, text/html, multipart/related, or multipart/alternative in the multipart (unless they have a 'Content-Disposition: attachment' header) and include all remaining subparts in the returned iterator. When applied to a multipart/related, return all parts except the root part. Return an empty iterator when applied to a multipart/alternative or a non-multipart. rrxrNryrzFr{Tr) r rrrrr)rr1pop _body_typesrt) rerrrrrzr attachmentsrRseens riter_attachmentsMIMEPart.iter_attachments*s[!11399#> { "g&> ""$ LLNE { "w)';NN7+E !Dxx -6 $#**40 " *** IIaL   D $ 5 5 7 = =c B H#t'7'77**,,1D G$J 7   $+ sI?EE A'E9E:EEA4E EEEEEc#l# UR5(aUR5ShvN ggN7f)znReturn an iterator over all immediate subparts of a multipart. Return an empty iterator for a non-multipart. N)rrrjs rr|MIMEPart.iter_partsas0     '') ) )  )s )424)content_managerc`UcURRnUR"U/UQ70UD6$r)r\r get_contentrerargskws rrMIMEPart.get_contentis2  ""kk99O**4=$="==rcbUcURRnUR"U/UQ70UD6 gr)r\r set_contentrs rrMIMEPart.set_contentns/  ""kk99O##D64626rc0UR5S:Xa4UR5nX!4-nXB;a[SRXA55e/n/nURHOupxUR 5R S5(aURXx45 M=URXx45 MQ U(a9[U5"URS9n XilURU l U /Ul O/Ul XPlSU-US'UbURSU5 gg)NrxzCannot convert {} to {}content-rnz multipart/rr@) rrrIrr]r0rFr1rr\r_r) rerdisallowed_subtypesr@existing_subtype keep_headers part_headersrr*rRs r_make_multipartMIMEPart._make_multipartss  $ $ &+ 5#779 "5 "B 6 !:!A!A$"/00  ==KDzz|&&z22##TM2##TM2 ) :T[[1D(M MMDM!FDMDM$ +g5^   NN:x 0 rc*URSSU5 g)Nry)rmixedrrer@s r make_relatedMIMEPart.make_relateds Y(@(Krc*URSSU5 g)Nr)rrrs rmake_alternativeMIMEPart.make_alternatives ]JArc*URSSU5 g)Nrr`rrs r make_mixedMIMEPart.make_mixeds Wb(3r)_dispcUR5S:wdUR5U:wa[USU-5"5 [U5"URS9nUR "U0UD6 U(a SU;aX%S'UR U5 g)Nrxmake_rnr;zContent-Disposition)rrgetattrrr\rr)re_subtyperrrrRs r_add_multipartMIMEPart._add_multiparts{  % % '; 6((*h6 D'H, - /Dz- $%"% *$6*/& ' Drc4UR"S/UQ7SS0UD6 g)Nryrinlinerrerrs r add_relatedMIMEPart.add_relateds ICCHCCrc0UR"S/UQ70UD6 g)Nrrrs radd_alternativeMIMEPart.add_alternatives M7D7B7rc4UR"S/UQ7SS0UD6 g)Nrrrrrrs radd_attachmentMIMEPart.add_attachments GEdE,E"Erc /UlSUlgrr]r_rjs rclearMIMEPart.clears  rcURVVs/sH.upUR5RS5(aM+X4PM0 snnUlSUlgs snnf)Nr)r]r0rFr_)renrs r clear_contentMIMEPart.clear_contentsL,0MMBMDA ! 4 4Z @ !MB  Bs *AArr)FNN))ryrr)rYrZr[r\rfrirkrtr}rrrr|rrrrrrrrrrrrr_ __classcell__rgs@rrbrbs!A CQB:(1K5n*26> 267 16LB459D8Frrbc(^\rSrSrU4SjrSrU=r$)ric>>[TU]"U0UD6 SU;aSUS'gg)Nrr)rfr)rerrrgs rrEmailMessage.set_contents, T(R(  %#(D  &rr`)rYrZr[r\rr_rrs@rrrs ))r)NT)r]__all__rJreriorremailrremail._policybaser r r`email._encoded_wordsr rrcompiler'rr+r7r:rWrrbrr`rrrs ? n % &%)      JJ2 3   D($#>K %K %\\w\~)8)r