javascript mailto 附件不显示

发布于 2024-09-25 01:47:03 字数 1171 浏览 2 评论 0原文

我正在尝试创建一个小型网络应用程序,其中在一种形式中,用户可以输入某些参数作为消息的一部分,然后在他点击按钮后,它将显示 Outlook(取决于他的默认电子邮件客户端)电子邮件客户端弹出窗口显示他放置的所有详细信息..然后它将包含一个附件。

javascript代码如下所示:

function submitReport()
{
  var remarks = document.getElementById('remarks').value;

  if(remarks != '')
    body += 'Remarks: '+remarks;

  var href = 'mailto:[email protected]?subject=[Bug Report]  '+menu_path+'&body='+body;

  href += '&attachment="C:\\debug.log"';

  var form = DomUtils.createForm();
  form.setAttribute('action', href);
  form.submit();
}

我尝试警告“href”变量,它显示:

mailto: [email protected]?subject=[Bug Report]&body=message_body报告类型:每月开始日期:2010-05-01 00:00:00结束日期:2010-05-31 23:59:59&附件="C:\debug.log"

并且肯定会弹出一个外部客户端,其中包含所有主题、收件人电子邮件地址、正文。 但没有附件。以前有人遇到过这个吗? :(

这里使用的展望是 2007 年.. 如果我在 IE 中运行 Web 应用程序,它实际上会显示错误

“命令行参数无效。请验证您正在使用的开关。”

有什么想法吗?

i'm trying to create a small web app wherein in one form, the user may type in certain parameters as part of the message, then after he hits a button, it will show an Outlook (depends on his default email client) email client popup with all the details he placed.. and then it will include an attachment.

the javascript code looks like this:

function submitReport()
{
  var remarks = document.getElementById('remarks').value;

  if(remarks != '')
    body += 'Remarks: '+remarks;

  var href = 'mailto:[email protected]?subject=[Bug Report]  '+menu_path+'&body='+body;

  href += '&attachment="C:\\debug.log"';

  var form = DomUtils.createForm();
  form.setAttribute('action', href);
  form.submit();
}

i tried alerting the "href" variable and it shows:

mailto:[email protected]?subject=[Bug Report]&body=message_bodyReport Type: MonthlyStart Date: 2010-05-01 00:00:00End Date: 2010-05-31 23:59:59&attachment="C:\debug.log"

and surely an outclient popsup with all the subject, recepient email address, body..
but no attachment. anybody encountered this before? :(

the outlook used here is 2007..
if i run the web app in IE, it actually says an error

"The command line argument is not valid. Verify the switch you are using."

any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜血缘 2024-10-02 01:47:03

网页无法使浏览器使用硬盘上预先附加的文件打开用户的电子邮件客户端。

使用表单并在服务器端处理它,或者沿着行:

<p>Send an email to <a href="mailto:[email protected]">[email protected]</a>
and attach your log file.</p>

There is no way for a web page to cause a browser to open the user's email client with a file pre-attached from the hard disk.

Use a form and process it server side, or provide simple instructions along the lines of:

<p>Send an email to <a href="mailto:[email protected]">[email protected]</a>
and attach your log file.</p>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文