import imaplib
import getpass
email = "[email protected]"
sock = imaplib.IMAP4_SSL("imap.gmail.com", 993)
sock.login(email, getpass.getpass())
# select the correct mailbox...
sock.select()
# turn on debugging if you like
sock.debug = 4
then:
# use the undocumented IMAP4.literal attribute
sock.literal = "réception"
sock.uid('SEARCH', 'CHARSET', 'UTF-8', 'SUBJECT')