Send one email per day

Good afternoon.

Client would like to have a certain report generated once a day and emailed to her. Can I do this directly in a web app or will I have to create a console app that gets fired off once a day to generate the report?

-Bob Gordon

A CGI web app will quit if there are not sessions attached to it. A standalone web app will remain running until it is specifically quit.

But it seems like a helper console app that runs once a day (maybe using cron or something) to generate and send a report seems like a better design.

[quote=218272:@Paul Lefebvre]A CGI web app will quit if there are not sessions attached to it. A standalone web app will remain running until it is specifically quit.

But it seems like a helper console app that runs once a day (maybe using cron or something) to generate and send a report seems like a better design.[/quote]

Paul, I do not believe a CGI app quits after it has no session. Each session is a new process that eventually dies, but the core app remains when there are no more sessions.

I have the online demo of RubberViewsWE that has been running since September 14 that way.

That said, I agree a Console app on cron would be a lot more appropriate.

Thanks you both for the advice.

-Bob

[quote=218275:@Michel Bujardet]Paul, I do not believe a CGI app quits after it has no session. Each session is a new process that eventually dies, but the core app remains when there are no more sessions.

I have the online demo of RubberViewsWE that has been running since September 14 that way.[/quote]
My understanding is that the Xojo app, when run in CGI mode, is quit if there are no connections to it and that it gets automatically started if it is not running when a connection comes in. I haven’t tested this lately and it is certainly an implementation detail, but that is what I recall. I’m sure Greg will correct me if I’m wrong, which has been known to happen on occasion. :slight_smile:

I have a console app running in Windows that runs fine with the Task Scheduler. I had some trouble getting email to work because the program would end BEFORE the email completed sending.

I have several console apps doing “helper functions” (with and without email) that work very nicely with the Windows Task Scheduler.

If you want to use a console program post back here and I will post some code or you can look at this thread. Greg O’Lone provided the “magic fix”.
https://forum.xojo.com/24686-sending-email-from-a-console-app-before-it-ends

We wait for Greg to tell the law :wink:

CGI Apps do quit when idle.

But that should be no problem.
You can check in database the status and send email next time a session starts.
Just keep a field in database to keep track on who got an email.

Or write a second console app and create a crown job.