Hi All, I know that webapps can not use threads or something such as celery. As well I know sending the emails from the request is an option, though not a good one if many emails need to be sent. I have a solution below that I was planning to implement for my app (Flask App), and was wondering if anybody would be willing comment to on it, good or bad idea, alternative options, etc.
Technicians, when going to buildings enter their time and work performed in that building, and customers can log in and see the work being done in there buildings. I am wanting to implement a feature that emails the new work logs to the customer either daily or weekly. My Solution for this was:
- add a boolean field named approved to the work_log model
- add an email table to the db
- have a flask command (so i have app context ,db, etc) scheduled to run daily that collects all logs that are not approved.
- send an email with logs that need approving, and signed/timed (token) link that also contains the ids of the logs to administrator if any logs need editing ,they can be edited from admin panel before clicking the link
- the route that corresponds to token/link would mark off all the logs approved and populate the email table based off the approved logs
- a separate daily task would send emails from the email table then either delete them or mark them as sent
Thanks in advanced for any suggestions or ideas!