![](/img/trans.png)
[英]How to forward an email message captured using poplib to a different email address?
[英]Python: How to get HTML body of an email message using poplib?
我正在嘗試使用message.get_payload()獲取電子郵件的正文。
但是,即使原始消息是HTML格式(即正確顯示在我的郵件客戶端中),也只能檢索電子郵件的文本內容。 如何檢索消息的完整HTML內容?
從文檔中
get_payload([i[, decode]])
Return the current payload, which will be a list of Message objects when
is_multipart() is True, or a string when is_multipart() is False.
With optional argument i, get_payload() will return the i-th element of
the payload, counting from zero, if is_multipart() is True.
通常,HTML電子郵件作為MIME消息發送。 通常只有文本副本和HTML副本。 您是否檢查了消息中有多少部分,以及是否嘗試檢索其他部分?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.