How to get sent mail (Imap)?

import imaplib
import email

M = imaplib.IMAP4_SSL("", 993)
M. login("", "mypass")

M. select('Sent')
status, data = M. search(None, 'ALL')

imaplib.error: command SEARCH illegal in state AUTH, only allowed in states SELECTED

6 hours I how to get all sent mail messages.
June 5th 19 at 21:16
1 answer
June 5th 19 at 21:18
import imaplib

def login_credentials():
 return ("mail", "password")

def connect_imap():
 m = imaplib.IMAP4_SSL("", 993)
 details = login_credentials()
 m.login(details[0], details[1])
 return m
m = connect_imap()
ddate = '18-May-2018'"INBOX")
result, data = m.uid('search', None, '(SENTON %s)' % ddate)

CaIIs it
Yes it is, Thanks!. and where you found this code ? you can link to. - brook.Dare commented on June 5th 19 at 21:21
Is glued code , searched resources 15 , unfortunately I do not remember where I found the key point. - Randy_Beier commented on June 5th 19 at 21:24
, Like this - Randy_Beier commented on June 5th 19 at 21:27

Find more questions by tags Python