Mail extraction problem (something's wrong with split methods)

Luka Milkovic luka.milkovic at public.srce.hr
Mon Sep 13 11:55:14 EDT 2004


On Mon, 13 Sep 2004 07:32:47 -0500, Jeff Epler wrote:

> In either case, you perform the reverse steps on the reassembled message
> on the other end:
>     import email.Parser
>     decoded_message = email.Parser.Parser().parsestr(message)
>     decoded_message.get_type() # must be application/x-luka-milkovic
>                                # or this is not a message from your
>                                # program
>     bytes = decoded_message.get_payload().decode("base64")
>     # now pickle.loads or struct.unpack the bytes
> 
> Jeff

Hi Jeff, thanks for the info about SMTP protocol, I knew I was doing
something wrong, and now I know what exactly went wrong. I was thinking
about encoding, but at the time of the development of the sending part, I
decided to postpone it, and that seems to be a big mistake.

But, you mentioned MIME types and the methods of creating MIME mails. I
was always afraid of MIME because I don't understand it well (though I've
read documentation). I did what you told me to do about sending e-mail,
and it works fine. But when it comes to decoding the mail, I have some
problems. I connect to my POP3 server and download my MIME e-mail (using
command pop.retr()) and save it to a file tempMail.dat. I don't know what
to do next, I tried with the parser but it doesn't work. My code looks
like the one you've given above.

print bytes  command returns nothing, a blank line... I don't know what to
do, please help.

Thank you very much.




More information about the Python-list mailing list