How can i make that the session read the properties for each time?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Srinivas_Miriyala
Posted On:   Wednesday, May 23, 2001 12:01 AM

I got one problem with session Object. I am trying to send the mail recursively, like reading emails from database and forwording some message to them. For this i am calling my mail program in loop. here i got the problem.suppose before starting the my application if i don't have the internet connection,first time it is checking for SMTP server and giving Exception and the second time it is giving exception with out checking for smtp server even we connect to internet. Is it taking Existing Session and raising exception? why it is not checking for Smtp server other times even we have Inernet Connection.

Re: How can i make that the session read the properties for each time?

Posted By:   Anonymous  
Posted On:   Tuesday, May 29, 2001 06:04 AM

The whole connection depends on the session object, so if you want to change
the properties during runtime, you have to kill the connection
, make a new session object with the new Properties and reconnect .
If you use authenticator, you have to be reinit it also.

this line of code change my properties during runtime:

folder.close
store.close
authenticator = new Authenticator(properties);
session = getInstance(properies);
store.connect(..);
folder.open();


dont use the default instance when reconnecting.
this doesn't change the prop and session object. (this is not a good feature in javamail i think!)

hope this helps someone
Alex
About | Sitemap | Contact