python 使用poplib pop3协议收取邮件,pythonpoplib,[Python]代码
python 使用poplib pop3协议收取邮件,pythonpoplib,[Python]代码
[Python]代码
# pop3.py import poplib emailServer = poplib.POP3('your pop3 server name') emailServer.user('your mail account') emailServer.pass_('your mail password') # 设置为1,可查看向pop3服务器提交了什么命令 emailServer.set_debuglevel(1) # 获取欢迎消息 serverWelcome = emailServer.getwelcome() print serverWelcome # 获取一些统计信息 emailMsgNum, emailSize = emailServer.stat() print 'email number is %d and size is %d'%(emailMsgNum, emailSize) # 遍历邮件,并打印出每封邮件的标题 for i in range(emailMsgNum): for piece in emailServer.retr(i+1)[1]: if piece.startswith('Subject'): print '\t' + piece break emailServer.quit()
相关内容
- c,c++,java,python,ruby实现将文件读入数组的,pythonruby,c实现
- python从文本文件中选出使用频率最多的单词,,[Python]代
- python修改Windows注册表切换ie代理,pythonie,[Python]代码#
- python实现独身模式,python实现独身,class A:
- Python使用Decorator实现独身模式,pythondecorator,下面是要求
- Gmail 发信,gmail发信,Python语言: Gm
- Python 将DOC word文档转换为PDF,,下面代码只能在windo
- python遍历目录树代码,python历目录树,from os.path
- Python 发email 带附件,python发email附件,Python 发emai
- python的日志logging模块使用总结,pythonlogging,1.简单的将
评论关闭