【问题标题】:launch MS outlook with attachment in email在电子邮件中启动带有附件的 MS Outlook
【发布时间】:2014-08-14 06:04:14
【问题描述】:

在我的应用程序要求中发送带有附件的电子邮件。

只是为了打开带有附件的新邮件消息的 Outlook。 其余是否发送取决于用户:)

我使用下面的代码。

try {
String stLineSep; // String containing the system line separator
// Line separator:
stLineSep = System.getProperty("line.separator"); // Get it

Runtime.getRuntime().exec(
new String[] {"rundll32",
"url.dll,FileProtocolHandler",
"mailto:" + "&attachment=" + "c:\\ashish.txt"}
);//","attachment;filename="+strFileName
}
catch (Exception ex) {
ex.printStackTrace();
}

我可以在没有附件的情况下打开 Outlook,你能告诉我它如何使用附件。请帮忙 提前致谢

【问题讨论】:

    标签: java email outlook


    【解决方案1】:

    mailto: 不需要处理(http://abauchu.net/blog/post/2008/12/28/Handling-mailto-url-and-attachment-with-Gmail-from-the-desktop 发现的 mailto URL 方案 [RFC 2368])。一种解决方案是更直接地调用 Outlook,但它会导致非常紧密的耦合:http://www.grauberger.org/wordpress/2013/07/18/e-mail-mit-anhang-ueber-die-cmd-in-outlook-oeffnen/(语言是德语)它只是使用 Outlook 客户端可执行文件的固定路径...

    "C:\Program Files\Microsoft Office\Office14\Outlook.exe" /m "test@example.org?subject=WhateverSubjectYouWish&body=seeAttachmentOrWhatever" /a "C:\myAttachment.txt"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-16
      • 2018-05-24
      • 2021-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-25
      • 1970-01-01
      相关资源
      最近更新 更多