It depends by the Mail Server's configuration.
JavaMail doesn't allow to handle this timeout value because all accesses to the Mail Server are made using a remote protocol as POP3 or IMAP.
These protocols could not control the timeout setting because this procedure changes from Mail Server to Mail Server...
So you need to control this parameter accessing directly to the Mail Server administration. To alert the user for session timeout you have to use a parameter inside your application initially set to the value of the Mail Server's timeout and decrease its value once per second until it reaches 0.