I want to retrieve new mails using a shell script and if the mail I just retrieved has attachments, these attachments should be saved to a folder. Before the next mail is retrieved, the attachments should be processed individually, e.g. the name should be checked and the file should be moved etc.
I know how to retrieve mails from the command line and save the attachments (with mutt), but then all mail attachments are saved. So I cannot check and process the attachments for each mail immediately after receiving it.
I would be glad about tips.