【发布时间】:2016-06-14 21:25:09
【问题描述】:
我必须在 Outlook 中打开一个 html 代码,而不是发送电子邮件。我需要先在 Outlook 中打开内容,然后为用户提供一个选项来编辑它。
我希望用户手动发送电子邮件。我只想在 Outlook 邮件中显示信息,然后用户可以手动发送。
示例 html 内容:
<HTML>
<body>
<b>Hello test</b>
</body>
</HTML>
上面的html我需要在outlook邮件中打开。
代码:
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();
}
我不确定如何在 Outlook 中打开 html 内容。任何人都可以知道如何在 Outlook 中打开 HTML 内容而不是发送它。
【问题讨论】:
-
请详细说明
open a html content。不知道你的意思。 -
需要先在outlook中打开内容,然后提供一个选项让用户根据需要编辑它
-
outlook打不开html信息
-
@Sujeet Sinha 我只是详细说明了html内容
-
知道如何使用 java 实现