File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Rich html email in spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Rich html email in spring" Watch "Rich html email in spring" New topic

Rich html email in spring

vaijesh basavarajappa

Joined: Feb 04, 2013
Posts: 5
Hi All,

Please help to generate html tabs in email template using springs.i want to include tabs in email.For Example: TAB1 TAB2. on click of TAB1 i want show some text "abcd".On click of TAB2 i want to show some tex t "efgh".

I used following code:

public class CustomerController{

private JavaMailSender mailSender;

private VelocityEngine velocityEngine;

public ModelAndView add(HttpServletRequest request,
HttpServletResponse response) throws Exception {
MimeMessage message=mailSender.createMimeMessage();
MimeMessageHelper helper=new MimeMessageHelper(message,true);
helper.setSubject("Sending sample template");

Map<String, Object> model=new HashMap<String, Object>();
model.put("testing", "Ganesha is Lord");
String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "test3.vm", model);
FileSystemResource res = new FileSystemResource(new File("c:/header.jpg"));

helper.addInline("identifier1234", res);

System.out.println("Ganesha sending mail"+text);

return new ModelAndView("CustomerPage", "msg","add() method");



Test3.vm file contains:

<script type="text/javascript">

function activateTab(pageId) {
var tabCtrl = document.getElementById('tabCtrl');
var pageToActivate = document.getElementById(pageId);
for (var i = 0; i < tabCtrl.childNodes.length; i++) {
var node = tabCtrl.childNodes[i];
if (node.nodeType == 1) { /* Element */ = (node == pageToActivate) ? 'block' : 'none';

<img src='cid:identifier1234'>
<a href="javascript:activateTab('page1')">${testing}</a>
<a href="javascript:activateTab('page2')">Tab 2</a>
<div id="tabCtrl">
<div id="page1" style="display: block;">Page 1</div>
<div id="page2" style="display: none;">Page 2</div>

I could able to display the image.but tabs are not working.
Please help me.

Thanks in advance.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
An email client is not a web browser. I'm not aware that there is one that will execute JavaScript (and I hope there isn't).
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Are you using the Spring Framework? I can't tell, what is "springs" I have not heard of "springs"

The Spring Framework has no plural.

Also, Please use the CODE tags, there is a Code button above to add them. When posting code so we can read it with nice clean indentations.



Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Rich html email in spring
It's not a secret anymore!