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.
Related
I'm working on load testing a web application that sends links via email. I have a gmail account set up specifically to be the recipient for this. When generating new accounts I add a guid to the recipient email (eg. loadtest_nmndbiwpdi#gmaildomain.com). When I execute the test it will either succeed entirely or fail entirely, but failures seem to be pretty random.
Here is my search snippet:
if (!inbox.isOpen()) {
inbox.open(Folder.READ_ONLY);
}
SearchTerm toTerm = new RecipientTerm(RecipientType.TO, new InternetAddress(to));
messages = inbox.search(toTerm);
While the script is running, it executes this in a 100 iteration loop with a 3 second pause. When it's failing script output with imap debugging on repeatedly shows the following:
A4 SEARCH TO loadtest_nmndbiwpdi#gmaildomain.com ALL
* SEARCH
A4 OK SEARCH completed (Success)
But no actual result. during the period of execution, however, I can do a search in gmail for this recipient and it pops right up. Any suggestions for getting to the bottom of this?
Gmail doesn't exactly implement the IMAP spec, especially for searching. Gmail searches are always for whole words, although that shouldn't be a problem here.
You can try using the Gmail-specific support in JavaMail, e.g., the GmailRawSearchTerm class.
I implemented a local cache. I initialize it at the beginning of the load test scenario, downloading the last days messages and capturing the last messages UID (using gmail imap plugin). Any time a session looks for an email it looks in the local cache. If it's not there it sets a flag so other sessions don't overlap caching and retrieves the newest messages.
Because it was intermittent, I wanted to give it a few days. It's run perfectly for the past 4 days. I could probably go one step better and set up a listener on the folder for new mail, but for now I'm satisfied that gmail was just returning 'success' but not doing the search after so many imap searches in succession.
Thanks to all for your feedback and suggestions!
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
I have 2 fields that looks for username, the gets the email address and phone number from user's person document.
Creator_Email: #NameLookup([NoUpdate]; #UserName; "OfficePhoneNumber")
Creator_Ext: #NameLookup([NoUpdate]; #UserName; "OfficePhoneNumber")
The problem is there is one user reported that the extension did not pull out. It came out blank
I have checked on the person document and the phone number is there
the email address pull out correctly, but when I tested changing the first letter of first and last name to lower case (ie. Test.User#domain.com to test.user#domain.com), the field that pulls the email address still show up with Upper case.
I have tried to take the user.id and test it on a different PC and the problem persists.
Any idea why this happens? I know there are 2 address books set up in the company and that is not ideal but I have checked the 2 address books and make sure all the needed information are there.
The #NameLookup formula does a look up to a hidden view on the database, and sometimes you run into a situation where the index for that view isn't up-to-date. You can go to the database and press CTRL+SHIFT+F9 to rebuild all the views, or you can try to use the FORCEUPDATE flag in your formula.
I think you'll find that the #NameLookup call is finding people who have created entries for themselves in their personal address books. If those entries are incomplete, the lookups will fail to find the missing fields.
The #NameLookup will use the parameter...
Go to /File/Preferences/Location then is the current location find the Server Tab and check that you defined Domino Directory server (if empty user search on local)
Check also in the Mail tab, Recipient Name lookup that could "stop after first march" or exhaustively search ALL the names known on the client.
In #NameLookup you can also use [NoUpdate]:[Exhaustive]
be aware as mention before that view may be not up to date, that caching can occurs in the #NameLookup.
In place of this, I suggest to use:
#DbLookup("":"";YourServer:"names.nsf" ; "($VIMPeople)" ; #Name([ABBREVIATE] ;#UserName) ; "OfficePhoneNumber");
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
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)