Google Apps Engine mail fetch - python

How can I fetch mails from gmail account in Google Apps Engine Django application?

Configure your app to receive email, then, if it really has to be a gmail address, set up the gmail address to forward everything to your appspot address.

You could cronjob rss feed to gmail messages?
gmail rss
python cron

I would use libgmail -- seems to be the most popular pure-Python way to do it. However for app engine use I believe it would have to be ported to use urlfetch and I don't think anybody's done that yet (I'd happily receive news to the contrary!-).

Just use the Python's standard POP or IMAP client. Google does not provide a GMail API.

Related

To get accesstoken from microsoft outlook graph api for daemon app

I am trying to create a daemon python application which will get emails from outlook server using Microsoft outlook graph API. They have provided excellent tutorial and documentation on how to get it done for python app like django and flask. But I want to create daemon script which can get access code without using web interface(which was used in django).
Note: This app will only collect email from single email and will feed it to db.
Any help is appriciated.
It really depends on what kind of security you need. You can have your daemon/service authenticate with username/password directly, or you can have it authenticate with a certificate.
There are several different authentication scenarios, take a look at the docs page.
Either way, you need to register your daemon as an app in Azure and give it permissions to the Outlook API, just as if it were a web app.

how to send email with google app accounts using python smtplib?

I know how to send email by using python smtplib with normal google account. By when I try to send email with my business account, e.g. yu#mycompany.com, it doesn't work because I cannot set "less secure app access" here
https://www.google.com/settings/security/lesssecureapps
It is said “This setting is not available for Google Apps accounts.”
Any suggestions guys?
Thank you!
You can use google's 'App Passwords' feature. It means you can generate separate password for any application and use it for only this application.
This feature was invented to prevent compromising your primary password.
See answer here.
You may try this direct link if it will work for you to manage passwords.

IMAP in Corporate Gmail

I am trying to download emails using imaplib with Python. I have tested the script using my own email account, but I am having trouble doing it for my corporate gmail (I don't know how the corporate gmail works, but I go to gmail.companyname.com to sign in). When I try running the script with imaplib.IMAP4_SSL("imap.gmail.companyname.com", 993), I get an error gaierror name or service not known. Does anybody know how to connect to a my company gmail with imaplib?
IMAP server is still imap.gmail.com -- try with that?
If you're a domain admin you can use my library with a OAuth2 Service Account. If you're an individual user, you might want to look at my code for the oAuth2WebServerFlow. This should allow you to use OAuth (and not a password) to access GMail's IMAP.
https://github.com/richieforeman/oauth2gmail

Accessing Gmail account from Google App Engine

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 only allows http/s communication thru the urlfetch API.
IMAP cannot be used on the production servers.
You can try using urlfetch using GMail built in RSS feed (https://USERNAME%3aPASSWORD#gmail.google.com/gmail/feed/atom).
You can use Google Apps script to access your inbox and send the result to App Engine.
http://code.google.com/googleapps/appsscript/service_gmail.html
F.I. I use Apps Script with Google Spreadsheets to make reports, based on data in GAE, using a hmac signature to authenticate.

Google App Engine Python Authentication from API

I'm currently building a Python webapp on the Google App Engine and I want to expose various parts of my application via a JSON API. This API may be used in the form of a mobile client, or (for the purposes of testing) a headless Python script.
I need to be able to authenticate users before they perform operations on the API. I notice that the Users API does not support simple authentication [in the form of authenticate(username, password)] so merely sending the username/password to a URL and then later using some given token would not work.
Ultimately, I would like the application to use Facebook Connect in addition to its own logins.
Could somebody please suggest how is the best way to authenticate users in this situation, using a remote JSON API and the Google App Engine?
Cheers
You might want to check out the recently released oauth support. Failing that, you can implement your own authentication, for example by using simple or digest authentication.
Just for the record, I ended up going with the wonderful Tipfy framework in the end.

Categories

Resources