Python IMAP: =?utf-8?Q? in subject string

前端 未结 5 1004
忘掉有多难
忘掉有多难 2020-12-17 10:36

I am displaying new email with IMAP, and everything looks fine, except for one message subject shows as:

=?utf-8?Q?Subject?=

How ca

5条回答
  •  渐次进展
    2020-12-17 11:02

    High level IMAP lib may be useful here: imap_tools

    from imap_tools import MailBox, AND
    
    # get list of email subjects from INBOX folder
    with MailBox('imap.mail.com').login('test@mail.com', 'pwd', 'INBOX') as mailbox:
        subjects = [msg.subject for msg in mailbox.fetch()]
    
    • Parsed email message attributes
    • Query builder for searching emails
    • Actions with emails: copy, delete, flag, move, seen
    • Actions with folders: list, set, get, create, exists, rename, delete, status
    • No dependencies

提交回复
热议问题