Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting errors using JavaMail  RSS feed

 
Janelle Goldsmith
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have written an application which sends emails using JavaMail.Sometimes these mails are sent successfully without any issue.
But sometimes, I get errors like -
The email could not be sent because - Sending failed;
nested exception is:
class javax.mail.MessagingException: Could not connect to SMTP host: mail.hotmail.com, port: 25;
nested exception is:
java.net.ConnectException: Operation timed out: connect
or sometimes I get -
The email could not be sent because - Sending failed;
nested exception is:
class javax.mail.MessagingException: Could not connect to SMTP host: mail.hotmail.com, port: 25;
nested exception is:
java.net.ConnectException: Connection refused: connect
These errors occur very frequently and though the error messages indicate that the mail server is not accepting any request, is there some way to overcome it ?
Please reply ASAP...in a tight spot...:-(
Thanks in advance
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obviously you need to provide for trying again after a delay. I like to create objects that hold a mail message and place them in a queue. A separate Thread wakes up occasionally and tries to send the messages in the queue.
If you make the mail holding object serializable you could write it to disk for long term storage in a particular directory.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!