Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Sending email from JSP  RSS feed

 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to create a JSP page (contact.jsp) which will have an option of sending email. Code for sending the email will be server-side script. I'm confused about where should I to put logic. Java class or Servlet or another JSP file ? After sending the email system should come back to contact.jsp with status. Really appreciate any ideas.

Thanks
 
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any type of processing which does not render the view should not be done in a JSP.

The mail generation itself would use the JavaMail API.
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don�t try to fire email as soon as user submits the page.

The ideal way is, first insert mail details in database, have one mail daemon that periodically query the database and send mail as per the data exist in database and also log the success or failure status in the database.

The advantage of this way is that, if by any reasons there is problem in email sending routine, you can send emails later on after solving the problem as you already have failed email details in database.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!