Upload MSN messenger chat log to gmail - python

I am looking for a way to store all my msn messenger chat log (the xml file) to my gmail account.
Just like the gmail chat logs in the "Chats" folder.
Is there any program or web service provide this feature?
I didn't find any program or web service yet. So I guess I may need to write by myself.
I find out google provide a gmail api at http://code.google.com/apis/gmail/oauth/.
It looks like perfect for upload some generated mails to my gmail account.
However, It looks like I need to generate extra headers such as "Recevied", "Received-SPF".
Do all these mail headers required?
I would like to download some gmail chat logs as file format reference, but the chat logs looks like cannot download by imap or pop3. Is there a way I can read the raw mail data?
Thank you. Best Regards

Related

How to retrieve data from Instagram that is absent in their API

I am currently trying write a code to retrieve an Instagram users email. This is not feasible through their API. The manual way to do it is to go on a mobile phone (not feasible from desktop) and if they have a business account there will be an option called Email which will then open Gmail and give you the email. Is there a way for me to run a bot through the Instagram App to retrieve that information and export it back to my computer? Time is not an issue for how quickly the data is retrieved, I could run the code overnight, but I was curious as to how/if this was feasible.
Thank you!

Authentication Error when trying to access a gmail business account to read emails - using IMAP_4SSL

I am trying to access a gmail account so I can read emails and save PDFs attached to those emails. I wrote the code and it works fine when I tested it on my personal gmail account (something#gmail.com), but now that I am trying to do it for this new address (reporting#company.com, which is a gmail business account) my code isn’t working to even connect.
I get an error message saying
Error: b’[AUTHENTICATIONFAILED] Invalid Credentials (Failure)’
I know the login email and the password are both correct. I have already downloaded the credentials.json file from the Google API page.
My code is as below:
Mail = imaplib.IMAP4_SSL(“imap.gmail.com”)
Mail.login(“reporting#company.com”,’password’)
If you're still using a password in your code, then you need to get your users to enable Less Secure Apps, or if they're using 2-Step Verification, create an App Password.
However, a better approach would be to use OAuth instead of a password. If you've downloaded the credentials.json file from the Google Developers Console, you already did the first step. :) Google has a guide to use OAuth with IMAP in Python, as well as a code sample (see the TestImapAuthentication method there).
All I had to do was enable 2-step authentication on the google account.

Programatically Send Notification Email for an Office 365 Hosted Email Using REST or Python

I am starting work on a project that will involve sending an auto generated email to a user. I am (most likely) going to build the application using Python and Django and host it as an Azure web app. The outgoing email address (hello#example.com) is hosted on Office 365. After some digging it looks like the recommended method of sending emails is the 365 Outlook API. All the documentation shows how to authenticate using AAD for a user that is logging in. However, I need to access the same email address regardless of who is using the web app.
Is there a way to securely get access to an AAD token on the backed of the server without storing a password in plaintext? Preferably the it would be in Python or REST but if need be I can switch technologies.
You can create an app only following Client Credentials Grant flow, leveraging which you can authenticate and authorize for AAD in backend.
Here is a code sample on GitHub https://github.com/Azure-Samples/active-directory-python-graphapi-oauth2-0-access, which builds an app-only app leveraging AAD in Django.
Any further concern, please feel free to let me know.

Error logging into Gmail Via Python [Unauthorized Client]

I'm using a python library to log into Gmail. Pretty simple to get started with.
I'm trying to log into my account via this code.
import gmail
g = gmail.login(username, password)
and I receive this error
gmail.exceptions.AuthenticationError
Because google blocked the sign in attempt.
My question is that, is there a way to better authenticate to gmail so Google doesnt block my requests to sign in? I rather not go through the process of generating an OAuth code only because I have multiple gmail accounts I want to log into and retrieve emails from.
Thanks!

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.

Categories

Resources