博客
关于我
python接收邮件_Python POP3协议收取邮件方法
阅读量:95 次
发布时间:2019-02-26

本文共 1552 字,大约阅读时间需要 5 分钟。

POP3?????????????????Python???poplib?????????????POP3?????????????????Python???POP3???????????

POP3????

POP3?Post Office Protocol - Version 3?????????????3??????????????????????????????????????????????POP3?????????????????????POP3????????????????POP3??????????????

Python?????????

1. ??????

?????????poplib?????Python???????POP3???????

import poplib

2. ???POP3?????

????????????POP3?????????????your pop3 server name???????POP3???????????????POP3?????????995?

emailServer = poplib.POP3('your pop3 server name')

3. ??POP3???

????POP3??????????????????????????????

emailServer.user('your mail account')emailServer.pass_('your mail password')

4. ??????

????????????????POP3????????????1??????????????????????????

emailServer.set_debuglevel(1)

5. ?????????

??????POP3?????????????????????????????????????

serverWelcome = emailServer.getwelcome()print(serverWelcome)

6. ????????

POP3?????????????????????????????????????

emailMsgNum, emailSize = emailServer.stat()print(f'????? {emailMsgNum}???????? {emailSize}')

7. ??????

????????????????????????retr???????????i+1????????????1??????

for i in range(emailMsgNum):    for piece in emailServer.retr(i + 1)[1:]:        if piece.startswith('Subject'):            print(f'\t{piece}')            break

8. ????

???????????POP3???????

emailServer.quit()

????

  • ??????????????????POP3???????????
  • ????????????????POP3????????
  • ????????????1??????????????????
  • ????????????????????????????????????????
  • ??????

    ???POP3???????????????????Python????????????????????

    ????????????????????????????

    转载地址:http://qejk.baihongyu.com/

    你可能感兴趣的文章
    NodeJs连接Oracle数据库
    查看>>
    nodejs配置express服务器,运行自动打开浏览器
    查看>>
    NodeMCU教程 http请求获取Json中文乱码解决方案
    查看>>
    Nodemon 深入解析与使用
    查看>>
    NodeSession:高效且灵活的Node.js会话管理工具
    查看>>
    node~ http缓存
    查看>>
    node不是内部命令时配置node环境变量
    查看>>
    node中fs模块之文件操作
    查看>>
    Node中同步与异步的方式读取文件
    查看>>
    node中的get请求和post请求的不同操作【node学习第五篇】
    查看>>
    Node中的Http模块和Url模块的使用
    查看>>
    Node中自启动工具supervisor的使用
    查看>>
    Node入门之创建第一个HelloNode
    查看>>
    node全局对象 文件系统
    查看>>
    Node出错导致运行崩溃的解决方案
    查看>>
    Node响应中文时解决乱码问题
    查看>>
    node基础(二)_模块以及处理乱码问题
    查看>>
    node安装卸载linux,Linux运维知识之linux 卸载安装node npm
    查看>>
    node安装及配置之windows版
    查看>>
    Node实现小爬虫
    查看>>