Decoding MIME email.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas Williams

    Decoding MIME email.

    Hello everyone, my name is Tom W. And, I am new to the
    list, and have been using Python for about a year now.


    Anyway, I got a question! I am trying to decode MIME
    (base64) email from a POP3 server, but all I get is a
    corrupt file. I know that it good to begin with
    because I check it with another email client.

    This is what I am doing!

    ......

    f=open("msg.txt ","wb")
    f.write(filelne )
    f.close()
    mimify.unmimify ("msg.txt", "msg.jpg",
    decode_base64=1 )

    .........

    Is this right?

    Tom W

  • Sybren Stuvel

    #2
    Re: Decoding MIME email.

    Thomas Williams enlightened us with:[color=blue]
    > I am trying to decode MIME (base64) email from a POP3 server[/color]

    You are seriously messing things up. Base64 is something quite
    different from MIME. If you want to do Base64 decoding, skip the POP3
    and email stuff, and concentrate on the decoding first. It's better to
    split your problem into smaller parts.
    [color=blue]
    > all I get is a corrupt file. I know that it good to begin with
    > because I check it with another email client.[/color]

    Again: skip the email stuff. Create a base64 encoded file with
    "uuencode -m filename < filename" and try to decode that.
    [color=blue]
    > This is what I am doing!
    >
    > .....
    >
    > f=open("msg.txt ","wb")
    > f.write(filelne )
    > f.close()
    > mimify.unmimify ("msg.txt", "msg.jpg",
    > decode_base64=1 )
    >
    > ........
    >
    > Is this right?[/color]

    You show us everything except the actual base64 decoding stuff. Oh,
    and you can't be doing things right, since you get messed up files.

    Sybren
    --
    The problem with the world is stupidity. Not saying there should be a
    capital punishment for stupidity, but why don't we just take the
    safety labels off of everything and let the problem solve itself?

    Comment

    Working...