2016-06-14 78 views
0

我必须在Outlook中打开一个html代码,而不是发送电子邮件。我需要先在Outlook中打开内容,然后提供一个选项供用户编辑,如果他愿意的话。在outlook中打开HTML代码在java中

我希望用户手动发送电子邮件。我只想在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("[email protected]"); 
    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:[email protected]?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(); 
    } 

我不知道我怎样才能打开后市一个HTML内容。任何人都可以知道如何在Outlook中打开HTML内容而不是发送它。

+0

请详细说明'打开html内容。不确定你的意思。 –

+0

需要先在Outlook中打开内容,然后提供一个选项让用户编辑它,如果他愿意的话 – bharathi

+0

我无法在outlook中打开html信息 – bharathi

回答

0

您正在使用的方法只是使用URI组件中发送的参数打开用户计算机上存在的所有邮件客户端。如果您检查link,则不能使用此方法发送HTML内容!