List of gmail atom available labels - gmail

I use 'Atom' feeds to read the content of gmail at the address
https://mail.google.com/mail/feed/atom/name where name is either empty (to check the inbox) or a user-defined label (even nested). To parse the result, it is useful to read the XML field fullcount, which gives the number of unread messages. With Gmail internal labels, like starred, important, sent, trash, drafts, spam, all, however, the fullcount is always 0. I recently discovered here that for the important label one should use the less intuitive name ^iim. With ^iim the fullcount is set correctly ! Does anyone know if there is a complete list of such labels available ?

They are called system labels and the Gmail Content Provider in Android documents a few:
ALL_MAIL ^all
DRAFTS ^r
INBOX ^i
INBOX_CATEGORY_FORUMS ^sq_ig_i_group
INBOX_CATEGORY_PRIMARY ^sq_ig_i_personal
INBOX_CATEGORY_PROMOTIONS ^sq_ig_i_promo
INBOX_CATEGORY_SOCIAL ^sq_ig_i_social
INBOX_CATEGORY_UPDATES ^sq_ig_i_notification
PRIORITY_INBOX ^iim
SENT ^f
SPAM ^s
STARRED ^t
TRASH ^k

Related

How IMAP client can detact Gmail Label rename programmatically

I am working on Email client App and using GMAIL IMAP condstore capability for syncing label,read and unread changes.
My application flow looks like below.
1) Initially Selecting the "Gmail/All Mail"
2) Fetching the changes from the server since last sync with last modseq like
FETCH 1:* (X-GM-LABELS) (CHANGEDSINCE highestmodseq)
Here IMAP server returns the messages for which label,read and unread changes detected since last sync.
Suppose I have label "A" and it has got 100 emails. Now if Label A is deleted then server returns 100 messages as changes,it works as expected.
But in case if label "A" is renamed to Label "B" then server should return 100 messages as changes but it won't.
Can you please suggest how to sync messages which are under Label A previously and got renamed to Label B
PS: According to IMAP server standards uniqueness of a label is identified based on label name and uid validity.
Gmail labels are retrieving with 'LIST "" "*"'.
Suppose if Label is renamed to some thing else then how to find whether it was newly created label or the renamed label
Thanks
Subbi Reddy
PS: According to IMAP server standards uniqueness of a label is identified based on label name and uid validity.
This is not true. The IMAP protocol does not define a "label". It defines what a "mailbox" is, and that each message has a set of "flags" or "keywords".
When GMail decided to implement IMAP, they made an unfortunate choice to shoehorn their concept of labels on top of the mailboxes instead of reusing the existing flags metadata. (They had some reasons for that, some of them are valid, some of them are not, and that discussion is out-of-scope for stackoverflow.)
But in case if label "A" is renamed to Label "B" then server should return 100 messages as changes but it won't.
This understanding certainly makes sense. The fact that GMail behaves differently is disappointing from the IMAP client's perspective. I suggest to bring this up to GMail's developers; they do read the ietf-imapext mailing list.
You're correct that a label rename seems like it should result in updates to the MODSEQ of all messages whose label set was affected by the rename. But it doesn't. So you're going to have to fetch the list of folders/labels and correlate the old label list with the new one.
As you know, you get the list of Gmail labels by issuing a LIST command:
A001 LIST "" "*"
What happens when the response to this command differs from the previous set of folders that you knew about? Unfortunately, IMAP doesn't give you a folder identifier that you can use to track an individual folder through renames. Fortunately, Gmail kinda sorta does.
(NOTE: THIS SOLUTION IS NOT SANCTIONED BY GMAIL, BUT IT APPARENTLY WORKS, SO THERE'S THAT.)
Every IMAP folder has a UIDVALIDITY value associated with it. It's generally there to let you know if somethin has happened on the server such that the UID-to-message mapping you've cached is no longer valid. According to the IMAP RFC,
3) If the [folder] is deleted and a new [folder] with the
same name is created at a later date, the server must
either keep track of unique identifiers from the
previous instance of the [folder], or it must assign a
new UIDVALIDITY value to the new instance of the
[folder].
4) The combination of [folder] name, UIDVALIDITY, and UID
must refer to a single immutable message on that server
forever.
Every folder exposed by Gmail IMAP happens to have a distinct UIDVALIDITY value. When you rename a folder, its UIDVALIDITY does not change. So if you notice that the set of folders has changed and you grab the UIDVALIDITY for every label-folder in the Gmail store, you can match up folders from your old snapshot and from the current store by finding which ones have matching UIDVALIDITY values.
# before, label "blurdybloop" had UIDVALIDITY 32
A002 STATUS "mylabel" (UIDVALIDITY)
* STATUS "mylabel" (UIDVALIDITY 32)
A002 OK Success
# this indicates that "blurdybloop" has been renamed to "mylabel"
If you want to be extra-careful, you may want to do a STATUS on every label folder even if the folder list hasn't changed just to catch circular renames like A -> B, C -> A, B -> C (which results in swapping the names of labels A and C). But that's probably overkill.
No, You can't do this with the IMAP language. Gmail labels are exclusively handled with http(s) API produced by Google.
IMAP has been designed to be used a set of commands send over TCP port 143.
You can check the list of the available commands.

How to remove a label from an email message from Gmail by using the IMAP protocol?

On Gmail adding labels works just fine:
imap.store(item, '+X-GM-LABELS', label)
imap.expunge()
But:
imap.store(item, '-X-GM-LABELS', label)
imap.expunge()
...which is supposed to remove the label will just do nothing, without returning an error ('OK').
What is the proper way to remove the label?
Years later, but for anyone landing here from Google, I ran into a similar (or identical) issue to the OP.
TL;DR: search by X-GM-LABELS instead of using imap.select(label)
The concise way to remove a label (as pointed out by Changneng) is:
imap.store(item, '-X-GM-LABELS', label)
However, since Gmail treats labels and folders somewhat interchangeably, but doesn't include the label on the copy of the message in a label's folder, the above won't work if you fetched the message using:
imap.select(label)
ok, data = imap.search(None, "ALL")
...
imap.fetch(item, "(RFC822)")
imap.store(item, '-X-GM-LABELS', label) # <-- Effectively a no-op
Using -X-GM-LABELS to remove the label won't work in that case, since the label isn't actually attached to the copy placed in that folder. Instead, you'll have to look up the copy of the email that's in the inbox (or presumably any other folder), and remove it from that id. For most intents and purposes, this method of loading messages should serve as a replacement for selecting the label's folder:
imap.select('inbox')
ok, data = imap.search(None, 'X-GM-LABELS', label)
...
imap.fetch(item, "RFC822")
imap.store(item, '-X-GM-LABELS', label) # <-- Will now remove the label!
The copy in the inbox folder will have all custom labels attached, and removing the label from that id (item) will remove the label, and remove the message from the label's folder in one shot.
Also, just a note, the above code will fail if your label has a space in it, in that case it needs to be wrapped in quotes, e.g. replace label with f'"{label}"'.
Gmail threat their labels as IMAP folders when you look on it by IMAP: https://support.google.com/mail/answer/77657?hl=en
As you are speaking about Gmail IMAP extensions - https://developers.google.com/gmail/imap_extensions#access_to_gmail_labels_x-gm-labels its doc say it may be used for add labels, store and search. I suppose it is just convenient way to work with it via standard IMAP protocol to do not search letter in all folders where it may be.
So if you want delete some label just remove message from this folder in terms of IMAP.
As tested, Gmail supports the following syntax to remove a label
imap.store(item, '-X-GM-LABELS', label)
No expunge statement needed.

Custom memo field isn't copied to Reply or Forward in Lotus Notes 6.5

I work in a development/support team which has a shared Lotus Notes mailbox. We need to be able to associate an issue ID with each email. We started by adding this ID to the subject line (eg. "Something doesn't work [ID12345]"). For performance reasons, our IT dept don't allow indexing of shared mailboxes, so it takes a long time to search for a particular ID.
I decided to add a new ID field, which can be shown as a sortable column in views and folders. I put this field to the visible header (just below 'Subject') in the ($All) view and the ($Inbox) folder, and copied the ($Inbox) design to all the other folders in the database. That much was easy.
My problem is that when we reply or forward, this custom field is not carried over to the new memo, so we have to manually add it again before sending. And of course when the user responds, the field is again missing and must be manually added. I have searched the docs and the internet and haven't found any information on this. Either I have to declare this field as something which persists across replies and forwards, or I have to add a line somewhere which explicitly copies the field contents to the new memo.
fsw,
We do exactly this with our complaint system however our database is indexed although this should not be an issue to you. We created a view that is sorted by ID by extracting just the ID from the subject line, order it by ID and then by date descending. Base it on the $ALL folder view so you get both incoming and sent emails.
We then altered the memo form to include an embedded view single category of the new view that sits above the body which shows all other documents linked to the ticket.
This should avoid having to delve to far into the very complex mail template any further. One thing is to make sure you have a copy of the changes you made and a bit of doco re deploying as you can guarantee that one day your template will be completely overwritten in an upgrade and all your good work will be gone.
As the additional field would have to incorporated into all Memo forms in mail templates in your corporation and as these fields do not easily travel via SMTP, you should stick with the ID in the subject.
What you could do is to parse the subject (#Mid, #Right, ...) in the column formula in the view and only display the ID there (like you did with the additional field).
The other option I envision if having a field is required is to have an agent that processes the incoming message(reply) to have it parse out the issue ID from the subject and write it to the field. You could also do that with queryopen or postopen if running an agent is not possible

WATIR: how do drive outlook web access

since the emails loads dynamically how do you find a specific email that contains a button back to your site. This is like signing up at a site. Customer receives email to confirm.
Thanks for the support
BigD
OWA, bless MS's little hearts (at least in the circa 2003 version I'm looking at here) uses frames, so first of all brush up on that or you are gonna be hating life. The list of incoming messages is in a frame named 'viewer' The message summaries are contained in a table lacking any useful means to identify it that is in a div of class 'msgViewerCont" and an ID of dvContents. So to see if a message exists you want to look to see if you can find a row in that table which contains the subject you expect to see.
(be careful using ID values on OWA.. apparently nobody in the group that developed it read the part of the HTML standard that specifies that ID values are supposed to be unique.. the re-use them all over that page.)
Presuming you know the subject of the message you are about to receive, and also that you keep that mail account cleared out so that it will be the ONLY message there with that subject line, then you can check to see if it exists usng
subject = regex.new("subject you are looking for")
browser.frame(:name, 'viewer').div(:id, dvContents).table(:index, 1).row(:text, subject).exists?
to click on it use .click instead of exists.
once you've clicked it, OWA will refresh the PreviewPane iframe.. inside that iframe is another one that has the message body in it.
all those frames, are nested inside the viewer frame. welcome to nested frame hell. hope you enjoy your stay. (like I said, bone up on frames, you're in for a fun ride)

How to manage Gmail labels in mutt

Is there a way to manage Gmail lables(Virtual folders) with mutt??
Quoting this source,
A very cool gmail feature is the ability to add label to emails (also called "tags" in other contexts), and then view only mails with a given label.
There is a semi-standard email header called "X-Label" which can be used to store labels. mutt supports searching it, filtering views according to the value, and showing it in the index view; but it doesn't allow you to change it (although there are patches).
There are some useful code snippets in the link above.

Resources