import poplib pop = poplib.POP3_SSL("pop.gmail.com",995) pop.user("帳號") pop.pass_("密碼") numMessages = len(pop.list()[1]) for i in range(numMessages): for j in pop.retr(i+1)[1]: print(j) pop.quit()
參考資料:
https://support.google.com/mail/troubleshooter/1668960?hl=zh-Hant
http://docs.python.org/3/library/poplib.html