I have a use case to fetch email attachments. I got this code from GitHub: imap-gmail.
Here this will extract attachments from all emails, but I need to make email read every time I check for attachments, and extract attachments only from new emails next time. And I need to select only pdf, doc and docx files. Also I need to append the email of the sender to the attachment file name.
How to make emails read while looping through each mail to fetch email attachments?