博客
关于我
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/

    你可能感兴趣的文章
    Oracle11g静默安装dbca,netca报错处理--直接跟换操作系统
    查看>>
    oracle12安装软件后安装数据库,然后需要自己配置监听
    查看>>
    Oracle——08PL/SQL简介,基本程序结构和语句
    查看>>
    Oracle——distinct的用法
    查看>>
    Oracle、MySQL、SQL Server架构大对比
    查看>>
    oracle下的OVER(PARTITION BY)函数介绍
    查看>>
    Oracle中DATE数据相减问题
    查看>>
    Oracle中merge into的使用
    查看>>
    oracle中sql查询上月、本月、上周、本周、昨天、今天的数据!
    查看>>
    oracle中sql的case语句运用--根据不同条件去排序!
    查看>>
    Oracle中Transate函数的使用
    查看>>
    oracle中关于日期问题的汇总!
    查看>>
    Oracle中常用的语句
    查看>>
    Oracle中序列的操作以及使用前对序列的初始化
    查看>>
    oracle中新建用户和赋予权限
    查看>>
    Oracle中的NVL,NVL2,NULLIF以及COALESCE函数使用
    查看>>
    Oracle中的rownum 和rowid的用法和区别
    查看>>
    oracle中的大小写、字符、dual、数字、处理、日期、函数、显/隐式、时间、条件表达式case、decode、to_date、to_char、sysdate
    查看>>
    oracle中表和视图的区别,oracle中常用表和视图
    查看>>
    oracle之表空间(tablespace)、方案(schema)、段(segment)、区(extent)、块(block)
    查看>>