Re: The lib email parse problem...

2006-08-30 Thread Fredrik Lundh
"" wrote: > i have use a temp method to overcome it . > > i still think the email lib should give the boundary border to parse > mail. the email lib you're using is a PARSER, and it's already PARSING the mail for you. (if you have trouble structuring your program when someone else is doing t

Re: The lib email parse problem...

2006-08-30 Thread 叮叮当当
thanks. i have use a temp method to overcome it . i still think the email lib should give the boundary border to parse mail. code is as following: def parse_mail_content(self, mail): content ='' alter =False subty ='' html ='' plain =

Re: The lib email parse problem...

2006-08-30 Thread neoedmund
myself wrote a multipart parser in java(i customise it because i need get information of "upload progress"). and i think it's also easy to implement in python, i've not have time done it, or i'll post it. but if you're no other special needs, just use email lib, it's quick to program and if you rea

Re: The lib email parse problem...

2006-08-30 Thread John Machin
On 30/08/2006 4:44 PM, 叮叮当当 wrote: > yes, the special is i must choose exactly one section to destruct, > instead of processing all subparts. So have you tried to use the example I posted yesterday? Do you still have any problems? Note: it is generally a good idea to post a message when you have

Re: The lib email parse problem...

2006-08-29 Thread 叮叮当当
yes, the special is i must choose exactly one section to destruct, instead of processing all subparts. John Machin 写道: > Tim Roberts wrote: > > "" <[EMAIL PROTECTED]> wrote: > > > > >i know how to use email module lib. > > > > > >the question is about how to handle the rfc 1521 mime > > >mul

Re: The lib email parse problem...

2006-08-29 Thread John Machin
Tim Roberts wrote: > "" <[EMAIL PROTECTED]> wrote: > > >i know how to use email module lib. > > > >the question is about how to handle the rfc 1521 mime > >mulitpart/alternitave part . > > > >i know emai can handle mulitpart , but the subpart alternative is > >special . > > No, it's not. A m

Re: The lib email parse problem...

2006-08-29 Thread Tim Roberts
"" <[EMAIL PROTECTED]> wrote: >i know how to use email module lib. > >the question is about how to handle the rfc 1521 mime >mulitpart/alternitave part . > >i know emai can handle mulitpart , but the subpart alternative is >special . No, it's not. A multipart/alternative section is construc

Re: The lib email parse problem...

2006-08-29 Thread John Machin
叮叮当当 wrote: > this is not enough. > > when a part is mulitpart/alternative, i must find out which sub part i > need, not all the subparts. so i must know when the alternative is > ended. > So you'll have to write your own tree-walker. It would seem that is_multipart(), get_content_type() and get_p

Re: The lib email parse problem...

2006-08-29 Thread Fredrik Lundh
"" wrote: > btw, i know how to use walk(), and the question is not this. so what is the question? -- http://mail.python.org/mailman/listinfo/python-list

Re: The lib email parse problem...

2006-08-29 Thread 叮叮当当
i know how to use email module lib. the question is about how to handle the rfc 1521 mime mulitpart/alternitave part . i know emai can handle mulitpart , but the subpart alternative is special . Steve Holden 写道: > 叮叮当当 wrote: > > supose a email part like this: > > > > Content-Type: Multipart

Re: The lib email parse problem...

2006-08-29 Thread 叮叮当当
this is just a temp solution for the simplest email format as my example, and i cannot always only show the html part. but in fact , there are many more difficult mail format btw, i know how to use walk(), and the question is not this. my code is as the following: def mail_content(mail): co

Re: The lib email parse problem...

2006-08-29 Thread Steve Holden
叮叮当当 wrote: > supose a email part like this: > > Content-Type: Multipart/Alternative; > boundary="Boundary-=_iTIraXJMjfQvFKkvZlqprUgHZWDm" > > > --Boundary-=_iTIraXJMjfQvFKkvZlqprUgHZWDm > Content-Type: text/plain; charset="gb2312" > Content-Transfer-Encoding: 7bit > >abcd. > --Boundary-=_i

Re: The lib email parse problem...

2006-08-29 Thread Fredrik Lundh
"" wrote: > the plain text is abcd, and the alternative content type is text/html, > i should prefer explain the html content, and i must not explaint the > two part ,so i want to get the boundary end. so use the email module: import email message_text = "..." message = email.m

Re: The lib email parse problem...

2006-08-29 Thread 叮叮当当
i just use email module lib. Max M 写道: > 叮叮当当 wrote: > > this is not enough. > > > > when a part is mulitpart/alternative, i must find out which sub part i > > need, not all the subparts. so i must know when the alternative is > > ended. > > > Have you tried the email module at all? > > > -- > >

Re: The lib email parse problem...

2006-08-29 Thread 叮叮当当
supose a email part like this: Content-Type: Multipart/Alternative; boundary="Boundary-=_iTIraXJMjfQvFKkvZlqprUgHZWDm" --Boundary-=_iTIraXJMjfQvFKkvZlqprUgHZWDm Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit abcd. --Boundary-=_iTIraXJMjfQvFKkvZlqprUgHZWDm Content-

Re: The lib email parse problem...

2006-08-29 Thread Max M
叮叮当当 wrote: > this is not enough. > > when a part is mulitpart/alternative, i must find out which sub part i > need, not all the subparts. so i must know when the alternative is > ended. Have you tried the email module at all? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Sci

Re: The lib email parse problem...

2006-08-29 Thread 叮叮当当
this is not enough. when a part is mulitpart/alternative, i must find out which sub part i need, not all the subparts. so i must know when the alternative is ended. John Machin 写道: > 叮叮当当 wrote: > > hi, all > > > > when a email body consist with multipart/alternative, i must know when > > the

Re: The lib email parse problem...

2006-08-29 Thread John Machin
叮叮当当 wrote: > hi, all > > when a email body consist with multipart/alternative, i must know when > the boundary ends to parse it, > > but the email lib have not provide some function to indicate the > boundary end, how to solve it ? By reading the manual. http://docs.python.org/lib/module-email.M

Re: The lib email parse problem...

2006-08-29 Thread Fredrik Lundh
"" wrote: > when a email body consist with multipart/alternative, i must know when > the boundary ends to parse it, or use a library that understands multipart messages. > but the email lib have not provide some function to indicate the > boundary end, how to solve it ? http://docs.pyt

The lib email parse problem...

2006-08-29 Thread 叮叮当当
hi, all when a email body consist with multipart/alternative, i must know when the boundary ends to parse it, but the email lib have not provide some function to indicate the boundary end, how to solve it ? thanks. -- http://mail.python.org/mailman/listinfo/python-list