Found a lot of examples how to send mail, but how can I read inbox? For example 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()
The SMTP protocol is for sending mails. If you want to look at your inbox - aka receive mails - you need to use POP3 or IMAP.
But just like smtplib
, Python also has imaplib
for IMAP and poplib
for POP3.