I'm currently stuck on this code. I'm able to mark emails to the trash but once it goes to the trash. I can't however select my trash folder and empty it. What am I doing wrong? Below is a snippet of my code.
MAIL_SERVER = 'imap.gmail.com'
USERNAME = 'email@gmail.com'#
PASSWORD = '123' #
MAILBOX = 'process' #
imap.select(MAILBOX)
typ, data = imap.search(None, 'ALL', search_args)
for num in data[0].split():
#this works and sends emails to trash
imap.store(num, '+X-GM-LABELS', '\\Trash')
#issue I'm having
imap.select('[Gmail]/Trash') # select all trash
imap.store(num, '+FLAGS', '\\Deleted') #Flag all Trash as Deleted
imap.expunge()
imap.close()
imap.logout()