Error in login imap-tools: "Response status "OK" expected, but "NO" received"

1.1k Views Asked by At

I'm having the following error:

Response status "OK" expected, but "NO" received. Data: [b'LOGIN failed.']

I'm using the library imap-tools. My code is in Python:

from imap_tools import Mailbox, AND

with MailBox('outlook.office365.com').login(login, password) as mailbox:

   data = datetime.today() - timedelta(days=1)
   data_anterior = data.strftime("%d-%b-%Y")

   for msg in mailbox.fetch(AND('SINCE 22-jun-2022')):
      message_ID = (msg.headers['message-id'])
      try:
         for att in msg.attachments: 
            if '.xml' in att.filename:
                get_enconding = chardet.detect(att.payload)
                payload = str(att.payload, get_enconding['encoding']).upper()
                
0

There are 0 best solutions below