【问题标题】:open a HTML code in outlook in java在java中的outlook中打开一个HTML代码
【发布时间】: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 实现

标签: java outlook


【解决方案1】:

您使用的方法只是使用在 URI 组件中发送的参数打开用户计算机上存在的任何邮件客户端。如果你勾选了link,很遗憾你不能使用这种方法发送HTML内容!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 2019-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-23
    相关资源
    最近更新 更多