Python 中的 MIME 解析与操作
1. MIME 简介
MIME(多用途互联网邮件扩展)是一种通过互联网邮件发送多部分多媒体数据的标准。它规定了用于指定和描述互联网消息体格式的机制。
一个 MIME 编码的消息示例如下:
Content-Type: multipart/mixed; boundary=”====_238659232==”
Date: Mon, 03 Apr 2000 18:30:23 -0400
From: Andre Lessa <alessa@lessaworld.com>
To: Renata Lessa <rlessa@lessaworld.com>
Subject: Python Book
—====_238659232==
Content-Type: text/plain; charset=”us-ascii”
Sorry Honey, I am late for dinner. I am still writing Chapter 13. Meanwhile,
take a look at the following Cooking material that you’ve asked me to find in
the Internet.
—====_238659232==
Content-Type: application/msword; name=”cookmasters.doc”
Content-Transfer-Encoding: base64
Content-Disposition: attachment, filename=” co