python email encoding and decoding problems

前端 未结 1 1892
情书的邮戳
情书的邮戳 2021-01-06 11:25

Basically I want to read all new emails from an inbox and put them in a database. The reason I use python is because it has imaplib, but I know nothing about it

相关标签:
1条回答
  • 2021-01-06 11:45

    Turns out it's quite easy. Even though all documentation points to the glorious past when the unicode function still was a real thing, 'str' does the same.

    So to recap, you have to pass 'decode=True' with 'getPayload' and wrap that around a str(...,'utf-8').

    0 讨论(0)
提交回复
热议问题