本文共 1552 字,大约阅读时间需要 5 分钟。
POP3?????????????????Python???poplib?????????????POP3?????????????????Python???POP3???????????
POP3?Post Office Protocol - Version 3?????????????3??????????????????????????????????????????????POP3?????????????????????POP3????????????????POP3??????????????
?????????poplib?????Python???????POP3???????
import poplib
????????????POP3?????????????your pop3 server name???????POP3???????????????POP3?????????995?
emailServer = poplib.POP3('your pop3 server name') ????POP3??????????????????????????????
emailServer.user('your mail account')emailServer.pass_('your mail password') ????????????????POP3????????????1??????????????????????????
emailServer.set_debuglevel(1)
??????POP3?????????????????????????????????????
serverWelcome = emailServer.getwelcome()print(serverWelcome)
POP3?????????????????????????????????????
emailMsgNum, emailSize = emailServer.stat()print(f'????? {emailMsgNum}???????? {emailSize}') ????????????????????????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 ???????????POP3???????
emailServer.quit()
???POP3???????????????????Python????????????????????
????????????????????????????
转载地址:http://qejk.baihongyu.com/