Check unread count of Gmail messages with Python

后端 未结 7 1417
面向向阳花
面向向阳花 2020-12-22 17:41

How can I check the number of unread Gmail message in my inbox with a short Python script? Bonus points for retrieving the password from a file.

7条回答
  •  [愿得一人]
    2020-12-22 18:11

    Use Gmail.py

    file = open("filename","r")
    usr = file.readline()
    pwd = file.readline()
    gmail = GmailClient()
    gmail.login(usr, pwd)
    unreadMail = gmail.get_inbox_conversations(is_unread=True)
    print unreadMail
    

    Gets login information from a text file assuming the login name and password are on separate lines.

提交回复
热议问题