Python, IMAP and GMail. Mark messages as SEEN

前端 未结 3 1423
北荒
北荒 2020-12-13 16:36

I have a python script that has to fetch unseen messages, process it, and mark as seen (or read)

I do this after login in:

    typ, data = self.serve         


        
3条回答
  •  情话喂你
    2020-12-13 16:58

    import imaplib
    obj = imaplib.IMAP4_SSL('imap.gmail.com', '993')
    obj.login('user', 'password')
    obj.select('Inbox')   <--- it will select inbox
    typ ,data = obj.search(None,'UnSeen')
    obj.store(data[0].replace(' ',','),'+FLAGS','\Seen')
    

提交回复
热议问题