Extracting email attachment when is_multipart() is False

Derrick 'dman' Hudson dman at dman13.dyndns.org
Wed Nov 26 18:47:40 CET 2003

On Wed, 26 Nov 2003 08:06:15 +0100, Davor Cengija wrote:
> John J. Lee wrote:
>> "Davor Cengija" <dcengija_IQ_Filter at inet.hr> writes:
>>> This is a multi-part message in MIME format.
>>> ------=_NextPart_000_0026_01C3B347.DBEA9660
>>> Content-Type: text/plain;
>> [...]
>> You seem to be missing the RFC 822 headers (From, To, Subject, etc.).
> Yes, that's true. The question is if it's easier to write a parser for that
> kind of messages or to force the message producing application to output the
> headers as well. We'll see...

You have a third option, which I would try if you can't get the
message producer to do it correctly:  slap some RFC822 headers on the
beginning, and then ignore them in the parsed message object.  After
all, if the rest of the data is correctly formatted, use the existing
tested MIME parser.  Prepending some "bogus" RFC822 headers would be
rather trivial to do.


 "Piracy is not a technological issue. It's a behavior issue."
                                                       --Steve Jobs
www: http://dman13.dyndns.org/~dman/            jabber: dman at dman13.dyndns.org

More information about the Python-list mailing list