How do I remove a shortcut from an email message from Gmail using IMAP?

In Gmail, tagging works fine:

imap.store(item, '+X-GM-LABELS', label) imap.expunge() 

But:

 imap.store(item, '-X-GM-LABELS', label) imap.expunge() 

... which should remove the label, just does nothing without returning an error ("OK").

How can I remove a shortcut?

+4
source share
2 answers

Gmail threatens its shortcuts with IMAP folders when you look at it via IMAP: https://support.google.com/mail/answer/77657?hl=en

Since you are talking about Gmail IMAP extensions - https://developers.google.com/gmail/imap_extensions#access_to_gmail_labels_x-gm-labels , his document says that it can be used to add tags, store and search. I believe that this is just a convenient way to work with it through the standard IMAP protocol, so as not to look for a letter in all folders where possible. Therefore, if you want to delete some tag, just delete the message from this folder in terms of IMAP.

0
source

As tested, Gmail supports the following syntax to remove a tag

 imap.store(item, '-X-GM-LABELS', label) 

No output instruction required.

0
source

Source: https://habr.com/ru/post/1487749/


All Articles