We have software that will produce reports in PDF and save them to directories based on client number and the date they were created. The software will email reports but requires that you insert recipient emails for each report, each time it is run. I am trying to write something that will find those PDFs and email them out on a regular basis. The reports will always have their report number and trailing digits so multiple versions of the same report will not replace existing PDFs (ex. 0945101.pdf and 0945102.pdf). The last 2 digits are incremented for each report with the same number. I have emailed with attachments, used databases, and sorted through files and folders looking for changes. I can find the files that are new and email them. The problem is, how to setup something for us to easily manage, which format to use, and is easy for me to code. The idea is that we would set it up once and not have to do it each time we run a report to email.
As I can see it now, there are a few possible situations for clients:
1. One person gets all reports
2. Individuals get one or more reports based on report number (09451*.pdf based on above example)
Some reports may go to more than one person
3. One or more individuals get one or more reports each and another individual gets all remaining reports
4. A combination of any of the above
I thought about having a file or database that would allow me to designate a catch-all email (for all reports not going to specific individuals and new reports added that are not setup), an all reports email, and emails with specific reports. I'm not sure how to structure it or how to loop through the files to attach them to email. Let me know if I need to clarify.