我的问题是关于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)");
}
}