To automatically extract attachments from thousands of email files via IMAP, I recommend you use the Softaken IMAP Attachment Tool. This tool is specially designed for extracting attachments from IMAP. It allows for to extraction of attachments from large volumes of emails in batch mode. It can recognize and safely download all types of attachments, PDF, DOC, XLS, JPG, ZIP, etc. It is 100% secure and the structure of the email data is retained. There is no need to install any additional email client like Outlook. This tool is Compatible with all Windows versions (Win 11, 10, 8.1, 8, 7, etc). You can download the free demo version of this tool, which allows extracting attachments from a limited emails.