我用 GAE 设置了一个邮件服务器。以下代码段显示了我如何接受和存储传入的邮件。
class ReceiveMailHandler(InboundMailHandler):
def receive(self, mail_message):
from uuid import uuid4
path_info = self.request.path_info
Mail(id=uuid4().hex,
receiver=path_info[len('/_ah/mail/'):].replace(at_domain, '@~'),
sender=mail_message.sender,
to=getattr(mail_message, 'to', ''),
cc=getattr(mail_message, 'cc', ''),
subject=getattr(mail_message, 'subject', ''),
body = '\n--\n\n'.join(b.decode()
for t, b in mail_message.bodies('text/plain')),
html = '\n--\n\n'.join(b.decode()
for t, b in mail_message.bodies('text/html')),
).put()
现在我收到一封邮件,其发件人是"=?utf-8?b?55+l5LmO?=" <notification@mail.zhihu.com>
如何"=?utf-8?b?55+l5LmO?="
使用 Python 解码字符串?