使用Python检查Gmail邮件的未读数 [英] Check unread count of Gmail messages with Python

查看:122
本文介绍了使用Python检查Gmail邮件的未读数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用简短的Python脚本检查收件箱中未读Gmail消息的数量?从文件中检索密码的积分。

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.

推荐答案

import imaplib
obj = imaplib.IMAP4_SSL('imap.gmail.com','993')
obj.login('username','password')
obj.select()
obj.search(None,'UnSeen')

这篇关于使用Python检查Gmail邮件的未读数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆