Problem using mimetools.encode

Gilles Lenfant glenfant at nospam-e-pack.net
Thu Oct 5 13:30:54 EDT 2000


Seems to be a bug in the "quopri.py", the module that encodes/decodes
quoted-printable.

Here is "my" fix of this module: change the "quote" function and comment or
remove the first 3 lines like this:

==== quopri.py ====
...
def quote(c):
## if c == ESCAPE:
##  return ESCAPE * 2
## else:
  i = ord(c)
  return ESCAPE + HEX[i/16] + HEX[i%16]
...
==== end quopri.py ====

Perhaps this fix is partial but the encoding works now (MIME messages are
now correctly decoded by Outlook Express/Netscape Messenger/StarOffice
Mail).

I submitted this bug and fix to the Python group but I don't know if this
bug is still in the latest libraries (1.6 and 2.0b2)

Hope this fixes your problem.

"Skip Montanaro" <skip at mojam.com> a écrit dans le message news:
mailman.970526780.20756.python-list at python.org...
>
> Sorry to bug the list, but I'm sort of at loose ends here.
>
> I tried using mimetools.encode to generate a quoted-printable MIME-encoded
> mail message body.  I ran the body through mimetools.encode(r, w,
> "quoted-printable") (where 'r' and 'w' were suitable StringIO objects) and
> included a "Content-Transfer-Encoding: quoted-printable" header in the
> message.  The message was sent using smtplib.SMTP().
>
> When I received the mail message it was all hacked up (basically
everything
> between two "=" signs on the same line were gone, including the "=" signs
> themselves) and the message contained an X-MIME-Autoconverted header that
> said in effect it had automatically converted the message to 8bit from
> quoted-printable.
>
> When I tried running mimetools.encode interactively, the output looked
> reasonable.  All attempts to locate information about X-MIME-Autoconverted
> headers were polluted by its occurrence all over the place in web-based
> mailing list archives.  I found nothing searching directly at sendmail.org
> (I run sendmail, so I presume it's ultimately the culprit).
>
> Any pointers to information on sneaking quoted-printable encoded messages
> through mail transfer agents (particularly sendmail) would be much
> appreciated.
>
> Thanks,
>
> --
> Skip Montanaro (skip at mojam.com)
> http://www.mojam.com/
> http://www.musi-cal.com/
>




More information about the Python-list mailing list