Answer the question
In order to leave comments, you need to log in
Why doesn't INBOX reading via IMAP4_SSL work on the server?
I'm trying to read incoming messages in a box for my own domain on yandex via IMAP4_SSL. When run on a server under Linux, it returns an empty value - OK [], however, if run from a working laptop on Mac OS it works correctly - OK [b'521 522'].
The script itself:
from imaplib import IMAP4_SSL
def get_mail():
connection = IMAP4_SSL(host=HOST, port=PORT)
connection.login(user=LOGIN, password=PWD)
status, msgs = connection.select()
assert status == 'OK'
typ, edata = connection.uid('SEARCH', None, '(FROM "{}")'.format(SENDER))
print(edata)
Answer the question
In order to leave comments, you need to log in
Problem solved.
The SEARCH command does not always work correctly with (FROM "[email protected]"). Separating the query elements helped:
typ, edata = connection.uid('SEARCH', None, 'FROM', 'no_reply')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question