module email

Rob Wolfe rw at smsnet.pl
Thu Jan 25 14:04:48 CET 2007


Sergey Dorofeev wrote:
> "Rob Wolfe" <rw at smsnet.pl> wrote in message news:874pqgf7hb.fsf at smsnet.pl...
>
> >> p2=email.message.Message()
> >> p2.set_type("message/rfc822")
> >> p2.set_payload(m)
> >
> > Payload is a _list_ of Message objects (is_multipart() == True)
> > or a _string_ object (is_multipart() == False) but never just Message
> > object.
>
> 1. If I give m.as_string() into set_payload, result is the same.

The payload of a message/rfc822 is treated like a sequence
of length 1. So that works:
p2.set_payload([m])

> 2. I don't understand, how message/rfc822 section can accept a list of two
> or more messages. Can you explain?

That's another question.
I don't understand either, why the payload for message/rfc822 has to be
a list of length 1 and not a Message object itself.
This assumption looks strange to me, too, but I can live with that. :)

-- 
Regards,
Rob




More information about the Python-list mailing list