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

本文共 1559 字,大约阅读时间需要 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/

    你可能感兴趣的文章
    Net操作配置文件(Web.config|App.config)通用类
    查看>>
    Neutron系列 : Neutron OVS OpenFlow 流表 和 L2 Population(7)
    查看>>
    New Relic——手机应用app开发达人的福利立即就到啦!
    查看>>
    NFinal学习笔记 02—NFinalBuild
    查看>>
    NFS
    查看>>
    NFS Server及Client配置与挂载详解
    查看>>
    NFS共享文件系统搭建
    查看>>
    nfs复习
    查看>>
    NFS安装配置
    查看>>
    NFS的安装以及windows/linux挂载linux网络文件系统NFS
    查看>>
    NFS的常用挂载参数
    查看>>
    NFS网络文件系统
    查看>>
    nft文件传输_利用remoting实现文件传输-.NET教程,远程及网络应用
    查看>>
    NFV商用可行新华三vBRAS方案实践验证
    查看>>
    ng build --aot --prod生成文件报错
    查看>>
    ng 指令的自定义、使用
    查看>>
    nghttp3使用指南
    查看>>
    Nginx
    查看>>
    nginx + etcd 动态负载均衡实践(三)—— 基于nginx-upsync-module实现
    查看>>
    nginx + etcd 动态负载均衡实践(二)—— 组件安装
    查看>>