I'm using python imaplib to synchronize imap messages with my database. Let's say that my newest message uid in my database is 170, I'm trying to get list of newest messages (greater than 170).
imap_server = 'my.imap.server'
mail = imaplib.IMAP4_SSL(imap_server)
mail.login(imap_user, imap_password)
start_message_uid = 169
if start_message_uid:
command = "UID {}:*".format(start_message_uid)
result, data = mail.uid('search', None, command)
else:
result, data = mail.uid('search', None, "ALL") # this returns list of all messages
but this command:
result, data = mail.uid('search', None, command)
Returns ["Error in IMAP command received by server."]
Can you point what I’m doing wrong?