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

    你可能感兴趣的文章
    Objective-C实现FFT算法(附完整源码)
    查看>>
    Objective-C实现fibonacci search斐波那契查找算法(附完整源码)
    查看>>
    Objective-C实现fibonacci斐波那契算法(附完整源码)
    查看>>
    Objective-C实现fibonacci斐波那契算法(附完整源码)
    查看>>
    Objective-C实现FIFO(附完整源码)
    查看>>
    Objective-C实现FigurateNumber垛积数算法(附完整源码)
    查看>>
    Objective-C实现finding bridges寻找桥梁算法(附完整源码)
    查看>>
    Objective-C实现first come first served先到先得算法(附完整源码)
    查看>>
    Objective-C实现FIR滤波器(附完整源码)
    查看>>
    Objective-C实现fischer yates shuffle洗牌算法(附完整源码)
    查看>>
    Objective-C实现FisherYates Shuffle洗牌算法(附完整源码)
    查看>>
    Objective-C实现fisherYates洗牌算法(附完整源码)
    查看>>
    Objective-C实现FloodFill洪水填充函数算法(附完整源码)
    查看>>
    Objective-C实现Floyd-Warshall算法(附完整源码)
    查看>>
    Objective-C实现FPmax算法(附完整源码)
    查看>>
    Objective-C实现frequency finder频率探测器算法(附完整源码)
    查看>>
    Objective-C实现FTP上传文件(附完整源码)
    查看>>
    Objective-C实现FTP文件上传(附完整源码)
    查看>>
    Objective-C实现FTP文件下载(附完整源码)
    查看>>
    Objective-C实现fuzzy operations模糊运算算法(附完整源码)
    查看>>