The mimify
module converts MIME-encoded text messages from encoded formats
to plain text (typically ISO Latin 1), and back. It can be used as a
command-line tool and as a conversion filter for certain mail agents:
$ mimify.py -e raw-message mime-message $ mimify.py -d mime-message raw-message
It can also be used as a module, as shown in Example 6-12.
Here’s a MIME message containing two parts, one encoded as
quoted-printable and the other as base64. The third argument to
unmimify
controls whether base64-encoded parts
should be decoded or not:
MIME-Version: 1.0 Content-Type: multipart/mixed; boundary='boundary' this is a multipart sample file. the two parts both contain ISO Latin 1 text, with different encoding techniques. --boundary Content-Type: text/plain Content-Transfer-Encoding: quoted-printable sillmj=F6lke! blindstyre! medisterkorv! --boundary Content-Type: text/plain Content-Transfer-Encoding: base64 a29tIG5lciBiYXJhLCBvbSBkdSB09nJzIQ== --boundary--
Here’s the decoded result (much more readable, at least if you know the language):
MIME-Version: 1.0 Content-Type: multipart/mixed; boundary= 'boundary' this is a multipart sample file. the two parts both contain ISO Latin 1 text, with different encoding techniques. --boundary Content-Type: text/plain sillmjölke! blindstyre! medisterkorv! --boundary Content-Type: text/plain kom ner bara, om du törs!
Example 6-13 demonstrates that encoding messages is just as easy.
3.14.142.194