Automate IMAP backup to PDF, including attachments

Hello,

I should backup an IMAP email server, including the email attachments. It’s a 5-yo account, so I have several GB of emails to backup. The backup should be a PDF print of each email.

I would separate incoming emails and outgoing emails, and create a folder for each email, which includes eventual attachments (PDFs etc.).

I don’t know if it could be possible to organize them as a thread inside the same PDF or folder.

Could you help me building my first flow?

Thanks!