Yahoo email "search and destroy"

Joined
Aug 16, 2022
Messages
10
Reaction score
0
Hello,

Want to search for user@wildcard domain, move those emails to folder called DUMP, then delete contents of DUMP.
Unfortunately I can't figure out how to do what I need above!
Any guidance is appreciated!!

My code below:
Python:
import imaplib

box = imaplib.IMAP4_SSL('imap.mail.yahoo.com', 993)
box.login("[email protected]","xxxxxxxx")
box.select('DUMP')
typ, data = box.search(None, 'from','name@*.*')
for num in data[0].split():
   box.store(num, '+FLAGS', '\\Deleted')
box.expunge()
box.close()
box.logout()


How can I modify above code to do what I need, please?
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top