dcsimg
Can we create our own event which will be fired when we are trying to connect mail server.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sundeep_nahar
Posted On:   Sunday, July 21, 2002 12:27 AM

Can we create our own event listeners by extending one of the adapter class? The problem is i am sending a mail using java mail api. When i am trying to send a mail using Transport.send(), mail server is busy and is not responding to my request. Due to this my program hangs for a while( i am not sure how long), and so my other operations are getting affected.
So is there any way to create an event listener which will be fired when my program tries to connect the mail server, so that i can keep a check that if mail server isnt responding in 10 seconds, i will come out of this and perform the next operation.

Re: Can we create our own event which will be fired when we are trying to connect mail server.

Posted By:   Gautam_Marwaha  
Posted On:   Sunday, July 21, 2002 11:55 PM

JavaMail provides certain Transport level events like ConnectionEvent and TransportEvent which may be useful to you. Refer to JavaMail spec for more details

Time taken to sending an email cannot be determined accurately as it varies over time, affected by several factors. If you do not really require emails to be sent synchronously, consider using asynchronous means like pushing messages to be sent out to a JMS queue, the consumer for which will do the mail sending. This way your app. need to wait for sending the messages.

About | Sitemap | Contact