• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Getting errors using JavaMail

 
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
 
Author and all-around good cowpoke
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
 
No more fooling around. Read this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic