How do I maintain a constant reference to an email on Gmail while access a copy of it from my Google App application?
I'm working on shifting my local web application to google apps. I have an account already for google apps for business and rig开发者_JAVA百科ht now I need to work on the functionality of interacting with email.
Let me give a synopsis - my web app currently was set up that a cron job would download all emails from a set mailbox into a database at short intervals and when each message would be entered they would be assigned a specific ID and we would be able to use that ID to refer to that message in our application wherever we would require. So basically our applications mail section gave the illusion of being a webmail client when nifact it would retrieve from a database. I'm interested in a solution with google apps on a similar case.
The thing is that the application initially when the cron job runs - not only does it download a the email from the mailserver but it would also delete the email from the mailbox. So basically we would refer to the email on our local database as that is where it would exist.
Now however I don't want to delete the email form the inbox at all. Infact I would like to set it up such that I can maintain a reference to an email on my gmail inbox and still have a copy in my local system or at the least a basic link to the email. The thing is that from my programming with email webclients I havent been able to find what is a UNIQUE ID for emails in the mailbox which could be used as a way to identify them from an external application - emails seemed to be numbered by sequence and the sequence changes when an email is moved between inboxes. The UID or unique ID value seems misleading as it is just a sequence number for that email which can change if earlier emails are deleted or moved about.
What would be the best way to do this?
Are you sure about the fact that the id changes? I just archived a message that was in my inbox. (I had copied the link beforehand). Then I took the link, and used it in a completely different browser (first time was FF, second time was Chrome). It pulled up the same e-mail.
Google's IMAP server supports a proprietary X-GM-MSGID command which allows retrieval of a message's Gmail UID.
https://developers.google.com/google-apps/gmail/imap_extensions#access_to_the_gmail_unique_message_id_x-gm-msgid
精彩评论