If the client’s been gone a long time and if I want to send them an email asking if they’re coming back or not.
Where do implement this?
The session object is retrieved from the request object.
If the client does not make any request for a long time, How to get the session object?
Is there any way to get list of all session objects and iterate?
Depending on Session objects is not a good practice for here. Because you need a data storage for a long time to approach this task.
Here, as the best solution, you can persist the last accessed time of each user to a database, so you can track it up anytime. For an example, if you are using a table named "Users" which contains some columns like "Name", "Password", ..... then you can insert another column as LastAccessedTime. (Or use this on another table, which is having a relationship with the Users table).
To send email notifications, you can use Timers or any other timed-method, so you can retrieve the users who didn't log-in for a long time. This can be done through an SQL statement or any other query language.