Я пытаюсь заархивировать все электронные письма. Перепробовал все ниже. Ошибки в комментариях. Есть ли другой способ удалить ярлык или заархивировать письмо?
gmail = imaplib.IMAP4_SSL("imap.gmail.com")
gmail.login(username, password)
gmail.select("Inbox")
gmail.store('1:*', '+X-GM-LABELS', '\\All Mail')
gmail.store('1:*', '+X-GM-LABELS', '\\"All Mail"') # Fails with imaplib.error: STORE command error: BAD ['Could not parse command']
gmail.store('1:*', '+X-GM-LABELS', '"[Gmail]\\All Mail')
gmail.store('1:*', '+X-GM-LABELS', '\\"[Gmail]/All Mail"')
gmail.store('1:*', '+X-GM-LABELS', '\\"All Mail"') # Fails with imaplib.error: STORE command error: BAD ['Could not parse command']
gmail.store('1:*', '+X-GM-LABELS', '\\Deleted')
gmail.store('1:*', '+X-GM-LABELS', '\\All Mail') # This applies 2 labels
gmail.store('1:*', '+X-GM-LABELS', '\\[Gmail]/All Mail') # This applies 2 labels# Fails with imaplib.error: STORE command error: BAD ['Could not parse command']
gmail.store('1:*', '+X-GM-LABELS', '\\Starred') # This applies stars
gmail.store('1:*', '+X-GM-LABELS', '\\Archive') # This applies the label \Archive
gmail.store('1:*', '+X-GM-LABELS', '\\All') # This applies the labe \All
gmail.store('1:*', '+X-GM-LABELS', '\\\'All Mail'') # This doesn't work
gmail.store('1:*', '+X-GM-LABELS', '\\ALL') # This applies the label 'ALL'
gmail.store('1:*', '+X-GM-LABELS', '\\"All Mail"') #imaplib.error: STORE command error: BAD ['Could not parse command']
gmail.store('1:*', '+X-GM-LABELS', '\All Mail') # Applies 2 labels : Mail and 'All'
gmail.store('1:*', '+X-GM-LABELS', '\AllMail') # Applies the label AllMail
gmail.store('1:*', '+X-GM-LABELS', '\\AllMail') # Applies the label \AllMail as tested on Thursday, 21 March 2019 at 16:37:43
gmail.store('1:*', '-X-GM-LABELS', '\\Inbox') #imaplib.error: STORE command error: BAD ['Could not parse command']
gmail.store('1:*', '-X-GM-LABELS', '\\INBOX') #imaplib.error: STORE command error: BAD ['Could not parse command']
gmail.expunge()