Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Rich html email in spring

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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{

@Autowired(required=true)
private JavaMailSender mailSender;

@Autowired(required=true)
private VelocityEngine velocityEngine;

@RequestMapping("/customer/add.htm")
public ModelAndView add(HttpServletRequest request,
HttpServletResponse response) throws Exception {
MimeMessage message=mailSender.createMimeMessage();
MimeMessageHelper helper=new MimeMessageHelper(message,true);
helper.setFrom("xxxx@gmail.com");
helper.setTo("xxxx@gmail.com");
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.setText(text,true);
helper.addInline("identifier1234", res);

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

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

}

}

Test3.vm file contains:

<html>
<head>
<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';
}
}
}

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

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

Thanks in advance.

 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

Thanks

Mark
 
Crusading Chameleon likes the size of this ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic