The lib email parse problem...

叮叮当当 guotie.9 at gmail.com
Tue Aug 29 05:42:00 EDT 2006


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/Alternative;
> > boundary="Boundary-=_iTIraXJMjfQvFKkvZlqprUgHZWDm"
> >
> >
> > --Boundary-=_iTIraXJMjfQvFKkvZlqprUgHZWDm
> > Content-Type: text/plain; charset="gb2312"
> > Content-Transfer-Encoding: 7bit
> >
> >    abcd.
> > --Boundary-=_iTIraXJMjfQvFKkvZlqprUgHZWDm
> > Content-Type: text/html; charset="gb2312"
> > Content-Transfer-Encoding: quoted-printable
> >
> > ..................
> > --Boundary-=_iTIraXJMjfQvFKkvZlqprUgHZWDm--
> >
> > 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.
> >
> > thanks all.
> >
> In other words, you *haven't* tried the email module.
>
> email.Parser can cope with arbitrarily complex message structures,
> including oddities like attachments which are themselves email messages
> containing their own attachments.
>
> Read the documentation and look for sample code, then get back to the
> list with questions about how to make email do what you want it to.
>
> Please don't ask us to re-invent existing libraries. that's why the
> libraries are there.
>
> regards
>   Steve
> --
> Steve Holden       +44 150 684 7255  +1 800 494 3119
> Holden Web LLC/Ltd          http://www.holdenweb.com
> Skype: holdenweb       http://holdenweb.blogspot.com
> Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list