• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Getting errors using JavaMail

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic