[Error] Reading mails and replying at the same time
Hello All
I am developing an application in which i m reading the mails from a gmail account using imap.gmail.com . The code is reading perfectly fine .
Now my code when finds a new email it reply back the mail using javamail
and for sending mail i m making a session smtp.gmail.com
and mailing the desired message back to the sender .
Now the logics good to me but i knew i will be having trouble with the session as the session i took during reading will not allow me to have a session to send the mails to the sender in the same code .
And when i executed it is reading the emails perfectly but when the mail is sending i get an Exception
Code:
Access to default session denied
So plz help me in this and one thing
is my suggestion correct that when i find a new mail i stop the current code and run the sending program in this session overlapping problem will not be there but it is untidy and not efficient suggestion so plz help me :)
Thanks in adv :)