如何使用 python 和 smtplib 阅读电子邮件

Ras*_*sul 5 python email smtp smtplib yandex

找到了很多如何发送邮件的例子,但我如何阅读收件箱?例如 yandex。

import smtplib as smtp

email = "me@example.com"
password = "password"

server = smtp.SMTP_SSL('smtp.yandex.com')
server.set_debuglevel(1)
server.ehlo(email)
server.login(email, password)
server.auth_plain()
# server.get_and_print_your_inbox_magic_method()
server.quit()
Run Code Online (Sandbox Code Playgroud)

fin*_*oot 7

SMTP协议是用于发送邮件。如果你想查看你的收件箱——也就是接收邮件——你需要使用POP3IMAP

但就像smtplib,Python 也有imaplibIMAP 和poplibPOP3。