• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

ignore exception when cannot connect to smtp server

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, I am doing a confirmation email system, basically, at a push of a button on my jsp page, data is sent to the action class and among other things an object is loaded to send an email. There are times when I will not be able to connec to the smtp server, I wish to allow the website to fully function when this happens. Currently, when I try to press that button, the page gives me an exception error
ignore exception javax.servlet.servletexception: javax.mail.messagingexception: unknown smtp host smtp.gmail.com; nested exception is..

When the smtp server is connected to and email is sent, the browser loads to home page. WHen it doesn't work, it gives that error message on the page. Is there a way for it to just load the home page instead of loading the exception message?
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to add in some exception handling (i.e. try/catch). Could you post the action class that handles the form and initiates the email communication?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no need to post the code, just wrap it in a try/catch. Alternatively, you could use Struts' declarative exception handling, but in this case I'd recommend against it.
 
Hey! Wanna see my flashlight? It looks like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic