使用已加入的pdf Java

时间:2018-04-09 13:22:13

标签: java email javafx desktop

我的问题是关于Java的桌面API(Desktop.Action.MAIL)我想用它来打开带有加入的pdf文件的默认邮件客户端的新邮件,我使用这段代码打开一个新邮件主题和填写的字段。

@FXML
private void sending_mail(ActionEvent event) throws URISyntaxException,IOException 
{
    Desktop desktop;
    if (Desktop.isDesktopSupported() && (desktop = Desktop.getDesktop()).isSupported(Desktop.Action.MAIL)) 
    {
        URI mailto = new URI("mailto:example@example.com? subject=Hello%20World");
        desktop.mail(mailto);
    } 
    else 
    {
        throw new RuntimeException("desktop doesn't support mailto)");
    }
}

0 个答案:

没有答案