Assistance debuging imaplib errors - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Assistance debuging imaplib errors (/thread-38007.html) |
Assistance debuging imaplib errors - Linh_lee - Aug-20-2022 Hello all, Getting close to what I want to accomplish, below is new simplified code. I just need assistance please in debugging the errors. What I want to accomplish: Search folder called "SPAM", for specific_user@any domain, and delete found mail. New code: import imaplib box = imaplib.IMAP4_SSL('imap.mail.yahoo.com', 993) box.login("[email protected]","xxxxxxxxxx") box.select('SPAM') typ, data = box.search(None, 'from','name@*.*') for num in data[0].split(): box.store(num, '+FLAGS', '\\Deleted') box.expunge() box.close() box.logout()Generating these errors below, please assist in debugging, thanks:
RE: Assistance debuging imaplib errors - Linh_lee - Aug-21-2022 FOLLOWUP: Through trial and error, I discovered Yahoo Mail Server, handles "select" request for ALL folders, both created, and system, EXCEPT one, SPAM!! The is only one folder Yahoo Mail Server doesn't accept a select box request for, SPAM folder. box.select('Spam') I did a resp_code, directories = imap_ssl.list() All directories/folders appear, both created, and system, EXCEPT one, SPAM!! The reason for the error then is, Yahoo Mail server rejects box.select('Spam'), script is then halted, and error is generated! Solutions/workaround anyone!? |