read mailbox programmatically

2,449 views
Skip to first unread message

Emmanuel dreux

unread,
Jan 29, 2012, 12:29:20 PM1/29/12
to google-app...@googlegroups.com
Hi,
I have a simple question : what api should I use to entirely read a mailbox programmatically?

I've found this link ( http://yellowduckguy.wordpress.com/2007/09/02/how-to-read-gmail-email-programmatically/) but I wonder if there are Google APIs for that?

Do you have a sample that you could share?

Thank you very much.

Claudio Cherubino

unread,
Jan 29, 2012, 3:30:46 PM1/29/12
to google-app...@googlegroups.com
Hi Emmanuel,

You have 3 options to read a mailbox programmatically:

1) the Gmail Inbox Feed (http://code.google.com/apis/gmail/docs/inbox_feed.html) which is also the solution described in your link, but that only lists the newest unread messages
2) use a standard IMAP client (http://code.google.com/apis/gmail/oauth/). Please take into account that the Gmail IMAP servers are extended to support OAuth for authentication (samples at http://code.google.com/apis/gmail/oauth/code.html)
3) use the Apps Script Gmail Services (http://code.google.com/googleapps/appsscript/service_gmail.html

Claudio

--
You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-apps-mgmt-apis/-/lgXVIzfdUlEJ.
To post to this group, send email to google-app...@googlegroups.com.
To unsubscribe from this group, send email to google-apps-mgmt...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Cooper Marcus

unread,
Jan 30, 2012, 12:06:49 PM1/30/12
to google-app...@googlegroups.com
One more option: http://context.io/ - may cost money, though probably not much, and is likely to be much easier to implement.

Full disclosure: My only relationship with Context.io is as a happy customer

Emmanuel dreux

unread,
Feb 3, 2012, 1:41:52 PM2/3/12
to google-app...@googlegroups.com
Thanks Claudio,

this might not be the best forum to follow up my issue. Don't hesitate to propose another place if there is a better forum.

We have finally implemented IMAP to retrieve an entire mailbox but we have an issue with messages that have more than one labels.
They are downloaded twice, if they have 2 labels and there would be a huge performance impact if we download all mails several times.

Is there anybody that has faced this problem? If so, how have you adressed it?

Thanks.

Jay Lee

unread,
Feb 6, 2012, 9:02:06 AM2/6/12
to google-app...@googlegroups.com
Hi Emmanuel,

  You can retrieve all the messages from the "All Mail" folder via IMAP and use the X-GM-LABELS Gmail IMAP extension to find out what labels each message has. This means you'll only be grabbing each message once.


The only messages this won't get is whatever is in Trash or Spam, those you'll need to grab separately if you need them.

Jay
Reply all
Reply to author
Forward
0 new messages