Accessing Gmail emails through google app engine

廉价感情. 提交于 2019-12-23 10:09:01

问题


How to get the e-mail contents by getting the user's login details in google app engine?


回答1:


Try taking a look at the GMail API. You'll probably want to use OAuth.

https://developers.google.com/gmail/




回答2:


This is exactly what I'm doing in my current project. Google App Engine Blog introduced a company named "Context.IO" and they provide very easy API to access GMail. I've implemented it in my project successfully.

Links
GAE Blog
Demo (You can look for a contact, and get all its emails...)

My Experience
They also provide a Explore feature that allow you to post and get json data from your gmail accounts.
However, if you registered for a free API key here, they will limit to 3 mailboxes per day. You can run a cron job to delete it daily. The nice thing is that you can contact them to get more mailboxes for development purposes :)

Hope my experience can help you




回答3:


You can also use google service account. https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount Then you can use it in order to get access to account under your domain.

$client = new Google_Client();
$client->setApplicationName('My App');
$client->setAuthConfigFile('path/to/service_account.json');

$client->useApplicationDefaultCredentials();
// account that we want to check 
$client->setSubject('account@mydomain.com');
$client->setAccessType('offline');  
$client->setScopes([Google_Service_Gmail::GMAIL_READONLY]);

$service = new Google_Service_Gmail($client);
$messagesResponse = $service->users_messages->listUsersMessages('me');


来源:https://stackoverflow.com/questions/9476777/accessing-gmail-emails-through-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!