Some addresses from this spam:
Code: Select all
a@kragar.imentss.com
a@octobertres.com
a@cngruel.com
Need help please, fixing invalid syntax error.
CODE:
Code: Select all
from imap_tools import MailBox, A
with MailBox('imap.mail.yahoo.com').login('name@yahoo.com', 'PWD', 'Bulk') as mailbox:
# DELETE messages that contains 'a@*.*' in body from Bulk folder
mailbox.delete(mailbox.fetch(A(body='a@*.*')))
ERROR:
Code: Select all
λ python DeleteEmailFiles.py
Traceback (most recent call last):
File "C:\Users\Desktop\Desktop\Python Spam Buster\DeleteEmailFiles.py", line 6, in <module>
mailbox.delete(mailbox.fetch(A(body='a@*.*')))
File "C:\Users\Desktop\AppData\Local\Programs\Python\Python310\lib\site-packages\imap_tools\mailbox.py", line 176, in delete
uid_str = clean_uids(uid_list)
File "C:\Users\Desktop\AppData\Local\Programs\Python\Python310\lib\site-packages\imap_tools\utils.py", line 30, in clean_uids
raise TypeError('uid "{}" is not string'.format(str(uid)))
TypeError: uid "<imap_tools.message.MailMessage object at 0x000001A96BC7BD90>" is not string