Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,

Actually I am developing an web application using jsp servlets. and database mysql.

I have developed an jsp page which contains data which comes from mysql database.

I have configured java mail system which can send mails.

whenever a user who views that page. if he wants to send that page as email to his friend or whoever he wants.

Now I want to send that jsp page(Entire Page but not that page's link) in email to any email id which user provides.

how can i achieve this any idea or any code will be more helpful.

Thanks in advance.....

Regards,
mike...
Posted

I'd put a button on your site which when clicked makes an AJAX call to a send mail function in a JSP page, passing the document.body.innerHTML as the body for the email.
If you want the images to be included in the email, rather than downloaded by the email client, that's a bit trickier and probably best avoided, though I believe it would be doable.

Details on how to send a mail using JSP can be found here: http://kb.hyve.com/wiki/SendHTMLEmailInJSP[^]

AJAX / JSP Example here: http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=580[^]

Embedding images in email here (scroll to the end to see the solution, even if your not an EE member): http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_21004301.html[^]

====Update====
If you're sending a different page to the one you're using to request that an email be sent, use an AJAX call to pull down the page to send as XML, then select the body node's contents in place of of document.body.innerHTML from the solution above.
 
Share this answer
 
v2
On the server side, pick up the e-mail address and create your HTML for the page to insert into the mail document.
I'm guessing that there is a point on this were you are getting stuck, so to make things easier, try this and let us know where you get stuck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900