• 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
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Sending a jsp page as the content of an email

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using java mail api to send emails in my application.The email is getting sent properly.But I am struggling with the content where I have a jsp page that includes 2 other jsp pages(header and footer).How to send this jsp page as the content.Currently I am using the following way to set the content of the email
Certainly this is extremely tedious.Is there a way out?I am calling the content setter method (for the email) from an action class in Struts 2
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I think the way in which you are proceeding is correct for sending the mail content.
I am not sure whether there is a way of sending jsp page content.
Even I had used StringBuilder instead StringBuffer to prepare HTML content and send it across via mail.

Thanks,
Ashwini Kashyap | www.infocepts.com
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to examine the following classes:
- javax.activation.URLDataSource class.
- javax.activation.DataHandler

Construct a DataHandler passing it the URL to include as the message part.
Hand the dataHandler off to your message - it should visit the URL you provided, and include it as the body of your email.



 
I am going to test your electrical conductivity with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic