Question

I have GoogleApps Gmail account and private Gmail account.
This two accounts are both having disabled IMAP/POP3 access, by domain setting for Apps and by account setting for private.

I want to know how can I access to either Gmail inbox even the IMAP/POP3 is disabled like official Gmail app by Google.

I also find out the Mailbox app by Dropbox can access inbox even I disabled the IMAP access If I approve OAuth2.0 access on private account. This was not possible on GoogleApps account.

Is there anyway to get access through it on GoogleApps account? If it's possible, I really appreciate any samples written on Python or Java.

Thanks.
JOHN

Was it helpful?

Solution

This is an example of login to gmail account using python2.7, hope this helps you:-

import urllib2
import getpass

FEED_URL = 'https://mail.google.com/mail/feed/atom'

def login(user, passwd):
    auth_handler = urllib2.HTTPBasicAuthHandler()
    auth_handler.add_password(
        realm='New mail feed',
        uri='https://mail.google.com',
        user='{user}@gmail.com'.format(user=user),
        passwd=passwd
    )
    opener = urllib2.build_opener(auth_handler)
    urllib2.install_opener(opener)
    feed = urllib2.urlopen(FEED_URL)
    print feed.read()

if __name__ == "__main__":
    user = raw_input("Enter username:")
    passwd = getpass.getpass("Enter Password:")
    login(user, passwd)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top