We have a web app that needs to send out notification emails, but I’m having problems. I planned to run a timer on the App level which would then run a thread to query the database and send out the emails.
First, I tested sending an email on app.open. That works great.
So I added a Timer Class to the project and a Property to the App based on the Class. Then I added this code to the App.com. The Timer Class action simply sends me an email on Action.
if AppNotificationsTimer = nil then
AppNotificationsTimer = New NotificationsTimer
AppNotificationsTimer.Mode = Timer.ModeMultiple
AppNotificationsTimer.Period = 5000
AppNotificationsTimer.Enabled = True
end if
That caused an SessionNotAvailableExeption: “control cannot be created because no session context” on AppNotificationsTimer = New NotificationsTimer.
So can I run code on the server ? Is there a way to make this work or a better way to accomplish the same?