从Google App Engine访问Gmail帐户 [英] Accessing Gmail account from Google App Engine

查看:153
本文介绍了从Google App Engine访问Gmail帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个库建立了一个IMAP客户端:

Gmail使用OAuth的IMAP和SMTP - 库和样本
http://code.google.com/apis/gmail/oauth/code.html



我需要搜索收件箱中的所有电子邮件,并且只返回与我的主题匹配并在过去24小时内发送的电子邮件。一旦我有这封电子邮件,我想阅读身体并做一些处理。我能够使用上述库完成所有这些工作,但是当我在GAE上部署此代码时,它会因为代码违例而失败,因为我的代码试图设置以下系统属性:

  props.put(mail.imaps.sasl.enable,true); 
props.put(mail.imaps.sasl.mechanisms,XOAUTH);
props.put(XoauthSaslClientFactory.OAUTH_TOKEN_PROP,oauthToken);

完成这项任务的其他选择是什么?很少有人谈论RSS feed。我们可以实现我在寻找使用这种技术的东西吗?任何输入将被赞赏。



谢谢。

解决方案

I听说 ContextIO 正在提供访问 GMAIL 帐户的API。我已经过测试,可以成功获取所有联系人,电子邮件,文件和电子邮件的正文。这些API非常易于使用。您需要一些步骤来获取ContextIO的使用者密钥。

他们还提供了一个API来从Google App Engine获取邮件。目前,我正在努力推出演示,希望能尽快更新此答案。但是,这样做非常直接和有趣:)

App Engine博客

上下文IO网站



希望它有帮助


I built an IMAP client using this library:

Gmail IMAP and SMTP using OAuth - Libraries and Samples http://code.google.com/apis/gmail/oauth/code.html

I need to search all the emails in the Inbox and return only those emails matching with my "subject" and which are sent in last 24hrs. Once i have that email i want to read the body and do some processing. I was able to do all of this using above library but when i deploy this code on GAE it fails with with "Security violation" as my code is trying to set some of the following system properties:

props.put("mail.imaps.sasl.enable", "true");
props.put("mail.imaps.sasl.mechanisms", "XOAUTH");
props.put(XoauthSaslClientFactory.OAUTH_TOKEN_PROP, oauthToken);

What are my other alternatives to achieve this task? Few people were talking about RSS feed. Can we achieve what i am looking for using this technique? Any inputs will be appreciated.

Thank You.

解决方案

I've heard that ContextIO is providing APIs to access GMAIL account. I've tested to get all contacts, emails, files, email's body successfully. The APIs are quite easy to use. You need some steps to obtain ContextIO's Consumer Keys.

They's also providing an API to fetch mails from Google App Engine. Currently, I'm working to bring a demo and hopefully will update this answer soon. However, it's very straight forward and interesting to do :)

App Engine Blogs
Context IO's site

Hope it helps

这篇关于从Google App Engine访问Gmail帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆