[英]How to get emails from Gmail on disabled access from IMAP/POP3
I have GoogleApps Gmail account and private Gmail account. 我有GoogleApps Gmail帐户和私人Gmail帐户。
This two accounts are both having disabled IMAP/POP3 access, by domain setting for Apps and by account setting for private. 通过应用的域设置和私有的帐户设置,这两个帐户都已禁用了IMAP / POP3访问。
I want to know how can I access to either Gmail inbox even the IMAP/POP3 is disabled like official Gmail app by Google. 我想知道我该如何访问Gmail收件箱,即使IMAP / POP3已被禁用,例如Google的正式Gmail应用程序。
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. 我还发现,即使我禁用了IMAP访问,Dropbox的Mailbox应用也可以访问收件箱。如果我批准了私人帐户的OAuth2.0访问。 This was not possible on GoogleApps account. 这在GoogleApps帐户上是不可能的。
Is there anyway to get access through it on GoogleApps account? 无论如何,是否可以通过GoogleApps帐户通过它进行访问? If it's possible, I really appreciate any samples written on Python or Java. 如果可能的话,我非常感谢使用Python或Java编写的任何示例。
Thanks. 谢谢。
JOHN 约翰
This is an example of login to gmail account using python2.7, hope this helps you:- 这是使用python2.7登录到Gmail帐户的示例,希望这对您有所帮助:-
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.