I cannot search sent emails in Gmail with Python

后端 未结 5 996
[愿得一人]
[愿得一人] 2020-12-28 20:51

I am trying to search for messages in the Sent (actually i care for both) but I only get incoming messages. For the time being i have

imap_conn.select()
str_         


        
5条回答
  •  既然无缘
    2020-12-28 21:46

    import imaplib
    obj = imaplib.IMAP4_SSL('imap.gmail.com',993)
    obj.login('userid','password')
    obj.select('Sent')  # <-- response like ('OK', ['74']) --> total no. of mail in sent folder
    obj.uid('SEARCH',None,'All') # <-- Returns the list of uids of the sent folder.
    

提交回复
热议问题