I have to open a html code in outlook instead of sending the email. I need to open the content in outlook first and then provide a option to user to edit it if he wants.
I want user to sent the email manually. I just want to display the information in outlook mail and then user can sent it manually.
sample html content:
<HTML>
<body>
<b>Hello test</b>
</body>
</HTML>
The above html I need to open in the outlook mail.
Code:
System.out.println("Gettjg in");
String recipientName = null;
System.out.println("receiver"+receiver.toString());
// Prepare the evaluation context
final Context ctx = new Context(locale);
ctx.setVariable("name", recipientName);
ctx.setVariable("remedyGroup", recipientName);
ctx.setVariable("regards", recipientName);
ctx.setVariable("assigneeName", recipientName);
ctx.setVariable("assigneeGroup", recipientName);
ctx.setVariable("subscriptionDate", new Date());
ctx.setVariable("hobbies", Arrays.asList("Cinema", "Sports", "Music"));
// Prepare message using a Spring helper
final MimeMessage mimeMessage = this.mailSender.createMimeMessage();
final MimeMessageHelper message = new MimeMessageHelper(mimeMessage, "UTF-8");
message.setSubject(receiver.getTicketSummary());
message.setFrom("thymeleaf@example.com");
message.setTo(receiver.getReceiverEmail());
// Create the HTML body using Thymeleaf
final String htmlContent = this.templateEngine.process("email-simple.html", ctx);
message.setText(htmlContent, true /* isHtml */);
try {
Desktop.getDesktop().mail( new URI( "mailto:bsenthilnathan@cognizant.com?subject="+message+"&cc="+"fsf"+"&body="+htmlContent));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I am not sure how can I open a html content in the outlook. Can anybody knows how to open the HTML content in a outlook instead of sending it.