• Post Reply Bookmark Topic Watch Topic
  • New Topic

Rich html email in spring  RSS feed

vaijesh basavarajappa
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.style.display = (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
Posts: 42972
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17309
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!