title: how to add a javascript to an email and send through thymeleaf
body: <p>I am trying to add javascript to the email template and my email template is,</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head&gt;
     &lt;meta charset="ISO-8859-1"&gt;&lt;/meta&gt;
      &lt;title&gt;Insert title here&lt;/title&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;p id="demo"&gt;JavaScript can change the style of an HTML element.&lt;/p&gt;
  &lt;script&gt;
  function myFunction() {
      var x = document.getElementById("demo");
      x.style.fontSize = "25px";           
      x.style.color = "red"; 
  }
  &lt;/script&gt;
  
  &lt;button type="button" onclick="myFunction()"&gt;Click Me!&lt;/button&gt;
  
  &lt;div class="mail"&gt;
      &lt;p th:text="#{greeting(${name})}"&gt; Hello, Peter Static&lt;/p&gt;
      &lt;div&gt;
            &lt;p th:utext="#{username(${userNamr})}"&gt;name&lt;/p&gt;
      &lt;/div&gt;
       &lt;div&gt;
           &lt;p th:utext="#{password(${password})}"&gt;name&lt;/p&gt;
       &lt;/div&gt;
  &lt;/div&gt;  
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p>in my controller
   I am using context object to set variable and I am using mimemessage to send the mail my problem  is mail part is working well but javascript part is not working </p>
  
  <pre><code>public String registrationHandler(HttpServletRequest request,final Locale locale,Model model) throws Exception {
          final Context ctx = new Context(locale);
            ctx.setVariable("name", "vignesh");
            ctx.setVariable("userNamr", request.getParameter("name"));
            ctx.setVariable("password", request.getParameter("password"));
            final MimeMessage mimeMessage = this.mailSender.createMimeMessage(); 
            final MimeMessageHelper message =  new MimeMessageHelper(mimeMessage, true, "UTF-8"); // true = multipart
            message.setSubject("User Name And Password");
            message.setFrom("info@example.com");
            message.setTo(request.getParameter("email"));
            final String htmlContent = this.templateEngine.process("mailTemplate.html", ctx);
            message.setText(htmlContent, true /* isHtml */);
            this.mailSender.send(mimeMessage);  
            model.addAttribute("mail", request.getParameter("email"));
            return "registrationSucess";
      }
  </code></pre>
  
  <p>I just want to know how to enable the javascript code in email template via thymeleaf.</p>