Get body text of an email using python imap and email package

后端 未结 3 1181
慢半拍i
慢半拍i 2020-12-03 19:42

I want to retrieve body (only text) of emails using python imap and email package.

As per this SO thread, I\'m using the following code:

mail = email         


        
3条回答
  •  不知归路
    2020-12-03 20:06

    Maybe this post (of mine) can be of help. I receive a Newsletter with prices of different kind of oil in the US. I fetch email in gmail with a given pattern for the title, then I extract the prices in the mail body using regex. So i have to access the mail body for the last n emails which title observe given pattern.

    I am using email.message_from_string() also: msg = email.message_from_string(response_part[1])

    so maybe it gives you concrete example of how to use methods in this python lib.

提交回复
热议问题